Compare commits
63
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5718be1c61 | ||
|
|
5c151a3a09 | ||
|
|
3c46c6cbb9 | ||
|
|
d31f09c174 | ||
|
|
063eeb34ec | ||
|
|
f06192601c | ||
|
|
091221ba2c | ||
|
|
7c22111ae0 | ||
|
|
daac3eed09 | ||
|
|
32ee7feea8 | ||
|
|
2026848a77 | ||
|
|
a7b205603c | ||
|
|
291d14f2d4 | ||
|
|
4a68137cfa | ||
|
|
b2f0374426 | ||
|
|
5fcca6ed0c | ||
|
|
a05c44ad1e | ||
|
|
f9880c8931 | ||
|
|
b876896628 | ||
|
|
375c2a3363 | ||
|
|
5dbc749000 | ||
|
|
36fbd91280 | ||
|
|
d2ad3e7ff1 | ||
|
|
072f1f112e | ||
|
|
6c79f98d3c | ||
|
|
8edebbb684 | ||
|
|
4839ca631a | ||
|
|
5018fe90de | ||
|
|
379144bcfe | ||
|
|
d2cd0ece5f | ||
|
|
10b7ccaa92 | ||
|
|
925eb618de | ||
|
|
96800de052 | ||
|
|
9df659b647 | ||
|
|
aec0bd5d11 | ||
|
|
c1c9c2c578 | ||
|
|
c739fa3ca1 | ||
|
|
355dfcb6c1 | ||
|
|
8f7c291e33 | ||
|
|
71fbb3df24 | ||
|
|
9cfa9b2c57 | ||
|
|
b9b8178e30 | ||
|
|
089cefb77b | ||
|
|
ee9ea1faab | ||
|
|
22b2cf8b0c | ||
|
|
10bd3c9dda | ||
|
|
6c3147fcf4 | ||
|
|
5e8d169c50 | ||
|
|
8657a35fd7 | ||
|
|
97c0b60a22 | ||
|
|
8a284d6c49 | ||
|
|
ff4b2f2dec | ||
|
|
aedce256af | ||
|
|
48b4b97132 | ||
|
|
6b1f88df66 | ||
|
|
d246c46227 | ||
|
|
7fdd9dc293 | ||
|
|
202861a900 | ||
|
|
4c41e7cb29 | ||
|
|
92823dcea9 | ||
|
|
795a5227bc | ||
|
|
bbd4bb99b7 | ||
|
|
f7443061ef |
No files matched your search
@@ -25,6 +25,7 @@ jobs:
|
||||
- name: "LBRY Integration Tests"
|
||||
install:
|
||||
- pip install coverage tox-travis
|
||||
- sudo mount -o mode=1777,nosuid,nodev -t tmpfs tmpfs /tmp
|
||||
script: cd lbry && tox
|
||||
after_success:
|
||||
- coverage combine lbry
|
||||
|
||||
+210
-109
@@ -41,10 +41,10 @@
|
||||
"examples": [
|
||||
{
|
||||
"title": "Get a file",
|
||||
"curl": "curl -d'{\"method\": \"get\", \"params\": {\"uri\": \"astream#68fde0328b1a267b3815ce974a6329b159619092\"}}' http://localhost:5279/",
|
||||
"lbrynet": "lbrynet get astream#68fde0328b1a267b3815ce974a6329b159619092",
|
||||
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"get\", \"params\": {\"uri\": \"astream#68fde0328b1a267b3815ce974a6329b159619092\"}}).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\": \"cbf954c2782b7cf571f7aa1de960202057618727\",\n \"channel_name\": \"@channel\",\n \"claim_id\": \"68fde0328b1a267b3815ce974a6329b159619092\",\n \"claim_name\": \"astream\",\n \"completed\": true,\n \"confirmations\": 3,\n \"content_fee\": null,\n \"download_directory\": \"/tmp/tmpdym2_jzz\",\n \"download_path\": \"/tmp/tmpdym2_jzz/tmpwc0xotjc\",\n \"file_name\": \"tmpwc0xotjc\",\n \"height\": 214,\n \"key\": \"b362c109c1773e239c7b8046b68baca1\",\n \"metadata\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpwc0xotjc\",\n \"sd_hash\": \"ca7f2e83a2d275e25151463521e893b8812aa0b061ab299fb9877521c0a2ced15927eeca4f50680d8ea5e03ae6b6c3f2\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"mime_type\": \"application/octet-stream\",\n \"nout\": 0,\n \"outpoint\": \"55a247d733323e8645656c1c817ac34411fafb5493f9c528091897b6ca0e5400:0\",\n \"points_paid\": 0.0,\n \"protobuf\": \"0127876157202060e91daaf771f57c2b78c254f9cb399c380097dccb958b0a22cddccfb1ff04aa93fa4022c09f2063b86e67ed1b5bc8546dfec3d1faf5c2c75c365722f78c508ba288b1f0cb3913fd391ff1796a1c0a90010a8d010a30fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd120b746d70776330786f746a63180b22186170706c69636174696f6e2f6f637465742d73747265616d3230ca7f2e83a2d275e25151463521e893b8812aa0b061ab299fb9877521c0a2ced15927eeca4f50680d8ea5e03ae6b6c3f2\",\n \"sd_hash\": \"ca7f2e83a2d275e25151463521e893b8812aa0b061ab299fb9877521c0a2ced15927eeca4f50680d8ea5e03ae6b6c3f2\",\n \"status\": \"finished\",\n \"stopped\": true,\n \"stream_hash\": \"b2749b74dd58556c9193970be68b3c439dd593e7f117cdbba75d3073307fdfa91e811ff9d3f71336eccefadb9d27effa\",\n \"stream_name\": \"tmpwc0xotjc\",\n \"streaming_url\": \"http://localhost:5280/stream/ca7f2e83a2d275e25151463521e893b8812aa0b061ab299fb9877521c0a2ced15927eeca4f50680d8ea5e03ae6b6c3f2\",\n \"suggested_file_name\": \"tmpwc0xotjc\",\n \"timestamp\": 1565587608,\n \"total_bytes\": 16,\n \"total_bytes_lower_bound\": 0,\n \"txid\": \"55a247d733323e8645656c1c817ac34411fafb5493f9c528091897b6ca0e5400\",\n \"written_bytes\": 11\n }\n}"
|
||||
"curl": "curl -d'{\"method\": \"get\", \"params\": {\"uri\": \"astream#bfb7d50e084d6d246ca9ff909c401aab30a6f9a6\"}}' http://localhost:5279/",
|
||||
"lbrynet": "lbrynet get astream#bfb7d50e084d6d246ca9ff909c401aab30a6f9a6",
|
||||
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"get\", \"params\": {\"uri\": \"astream#bfb7d50e084d6d246ca9ff909c401aab30a6f9a6\"}}).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\": \"1812d3275894f62a055d59189a75698a071108af\",\n \"channel_name\": \"@channel\",\n \"claim_id\": \"bfb7d50e084d6d246ca9ff909c401aab30a6f9a6\",\n \"claim_name\": \"astream\",\n \"completed\": true,\n \"confirmations\": 3,\n \"content_fee\": null,\n \"download_directory\": \"/tmp/tmptn5ym8in\",\n \"download_path\": \"/tmp/tmptn5ym8in/tmpmjego0ff\",\n \"file_name\": \"tmpmjego0ff\",\n \"height\": 214,\n \"key\": \"44c98cff66e9387514d212369d4af15e\",\n \"metadata\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpmjego0ff\",\n \"sd_hash\": \"2ab7bbd96cb5db43df9ff909c0555dd8a132866355768c41d24f2b4be7c0478ae5f82d2c853e95c9b1179c6743e4bb37\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"mime_type\": \"application/octet-stream\",\n \"nout\": 0,\n \"outpoint\": \"f3338742c2b4cf0e35b7ffa73aea3e9da786926cf82f07d3100e09d04ec3f231:0\",\n \"points_paid\": 0.0,\n \"protobuf\": \"01af0811078a69759a18595d052af6945827d31218a49f0b990dfb596d464fa5c166a752b4835b01f02dcabd712d4345b09c18ce4096395d25caf4fb962732f54d58df839f9dd7cc2ef1d4303c89e4dd553865ed060a90010a8d010a30fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd120b746d706d6a65676f306666180b22186170706c69636174696f6e2f6f637465742d73747265616d32302ab7bbd96cb5db43df9ff909c0555dd8a132866355768c41d24f2b4be7c0478ae5f82d2c853e95c9b1179c6743e4bb37\",\n \"sd_hash\": \"2ab7bbd96cb5db43df9ff909c0555dd8a132866355768c41d24f2b4be7c0478ae5f82d2c853e95c9b1179c6743e4bb37\",\n \"status\": \"finished\",\n \"stopped\": true,\n \"stream_hash\": \"d2fdfe280a77e5dd71f82cd531782ec5f71db1b2f9b6bf4da71240b5ad6fb21367d4b53e6f84fa83cc190aff004dd7bd\",\n \"stream_name\": \"tmpmjego0ff\",\n \"streaming_url\": \"http://localhost:5280/stream/2ab7bbd96cb5db43df9ff909c0555dd8a132866355768c41d24f2b4be7c0478ae5f82d2c853e95c9b1179c6743e4bb37\",\n \"suggested_file_name\": \"tmpmjego0ff\",\n \"timestamp\": 1567524492,\n \"total_bytes\": 16,\n \"total_bytes_lower_bound\": 0,\n \"txid\": \"f3338742c2b4cf0e35b7ffa73aea3e9da786926cf82f07d3100e09d04ec3f231\",\n \"written_bytes\": 11\n }\n}"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -219,10 +219,10 @@
|
||||
"examples": [
|
||||
{
|
||||
"title": "Publish a file",
|
||||
"curl": "curl -d'{\"method\": \"publish\", \"params\": {\"name\": \"a-new-stream\", \"bid\": \"1.0\", \"file_path\": \"/tmp/tmpoaodn53k\", \"tags\": [], \"languages\": [], \"locations\": [], \"channel_account_id\": [], \"funding_account_ids\": [], \"preview\": false, \"blocking\": false}}' http://localhost:5279/",
|
||||
"lbrynet": "lbrynet publish a-new-stream --bid=1.0 --file_path=/tmp/tmpoaodn53k",
|
||||
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"publish\", \"params\": {\"name\": \"a-new-stream\", \"bid\": \"1.0\", \"file_path\": \"/tmp/tmpoaodn53k\", \"tags\": [], \"languages\": [], \"locations\": [], \"channel_account_id\": [], \"funding_account_ids\": [], \"preview\": false, \"blocking\": false}}).json()",
|
||||
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"0100000001982e42647211b173408afa981022eba39ad37dd3af02adbbdbbbeeacf1264e47010000006b483045022100fe0ed627da7753b064ab5f105e1c96e2a9b421bc06507a33cf93fc4aeadd78e40220292679d815306c6cddccc02ddc78afee4244f5c397e97155ce106c805a542939012103624df3c8ad604cf580e3961b92cf2ddcc550b056d68cc59711f98bb2787b8b63ffffffff0200e1f50500000000bfb50c612d6e65772d73747265616d4c94000a90010a8d010a30fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd120b746d706f616f646e35336b180b22186170706c69636174696f6e2f6f637465742d73747265616d3230a586f76b0448807ffc4c620d73eba0472e1f9ddf65e25dee0b4fadabb371300aadc9ec6f9df51dc17b5775a8a7a013e96d7576a914deecc1b5bc5a7035d2011bcaf8e8da85f6f42bd188ace0b46217000000001976a914f159d3ab7d8917b22b68fcd95084ba80c59e852c88ac00000000\",\n \"inputs\": [\n {\n \"address\": \"n1C7SV6XSvTgHK84pMQ23KZLszCsm53T3Q\",\n \"amount\": \"4.947555\",\n \"confirmations\": 4,\n \"height\": 215,\n \"is_change\": true,\n \"is_mine\": true,\n \"nout\": 1,\n \"timestamp\": 1565587608,\n \"txid\": \"474e26f1aceebbdbbbad02afd37dd39aa3eb221098fa8a4073b1117264422e98\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"n1qfvnMjq54N8VZ6Lo9PHJqZnURANLnhuG\",\n \"amount\": \"1.0\",\n \"claim_id\": \"34e0cf03b59adf21fc691267905e92cccbf61867\",\n \"claim_op\": \"create\",\n \"confirmations\": -2,\n \"height\": -2,\n \"meta\": {},\n \"name\": \"a-new-stream\",\n \"normalized_name\": \"a-new-stream\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://a-new-stream#34e0cf03b59adf21fc691267905e92cccbf61867\",\n \"timestamp\": null,\n \"txid\": \"b320bd3bc3fd2d17959326f012e188c3cf7a9bc4080acab98aa88fcb896c401b\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpoaodn53k\",\n \"sd_hash\": \"a586f76b0448807ffc4c620d73eba0472e1f9ddf65e25dee0b4fadabb371300aadc9ec6f9df51dc17b5775a8a7a013e9\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"value_type\": \"stream\"\n },\n {\n \"address\": \"n3X6kZcWxner6175XwQ32SwHBTFTMRiw7T\",\n \"amount\": \"3.923448\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 1,\n \"timestamp\": null,\n \"txid\": \"b320bd3bc3fd2d17959326f012e188c3cf7a9bc4080acab98aa88fcb896c401b\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.024107\",\n \"total_input\": \"4.947555\",\n \"total_output\": \"4.923448\",\n \"txid\": \"b320bd3bc3fd2d17959326f012e188c3cf7a9bc4080acab98aa88fcb896c401b\"\n }\n}"
|
||||
"curl": "curl -d'{\"method\": \"publish\", \"params\": {\"name\": \"a-new-stream\", \"bid\": \"1.0\", \"file_path\": \"/tmp/tmp_djode3_\", \"tags\": [], \"languages\": [], \"locations\": [], \"channel_account_id\": [], \"funding_account_ids\": [], \"preview\": false, \"blocking\": false}}' http://localhost:5279/",
|
||||
"lbrynet": "lbrynet publish a-new-stream --bid=1.0 --file_path=/tmp/tmp_djode3_",
|
||||
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"publish\", \"params\": {\"name\": \"a-new-stream\", \"bid\": \"1.0\", \"file_path\": \"/tmp/tmp_djode3_\", \"tags\": [], \"languages\": [], \"locations\": [], \"channel_account_id\": [], \"funding_account_ids\": [], \"preview\": false, \"blocking\": false}}).json()",
|
||||
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"0100000001301509336d7105f77744b0d8658d111b6d5c7f4b91dd60a99a1abd58e47bd855010000006b483045022100da5af53f91b0d6f81c54fe45cd7294edad374db1538b8a842b52909fc0f81d7a022018f5c6e86caa14d8b7b9cd00fc58dc62a3dc85116f1502725417846ac425119801210303b03af351f59825ab5a3f81e2cd3ccd9bc81b08dd3894e37af617d989303048ffffffff0200e1f50500000000bfb50c612d6e65772d73747265616d4c94000a90010a8d010a30fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd120b746d705f646a6f6465335f180b22186170706c69636174696f6e2f6f637465742d73747265616d3230cd64057a0fc233a5414c2f0d55ab806faafddc220c4544e9dd1b6acf750553ce29d615b463cd9fed21b4444d209db4036d7576a914104e9db82ec98a53408ba517caa2bf2828ba028788ace0b46217000000001976a914310e5cdb39f601206132e8adcaa167f5b594b23f88ac00000000\",\n \"inputs\": [\n {\n \"address\": \"mk7Hr34G619JQ1wzFNRun1zWp9c8PLq7ze\",\n \"amount\": \"4.947555\",\n \"confirmations\": 4,\n \"height\": 215,\n \"is_change\": true,\n \"is_mine\": true,\n \"nout\": 1,\n \"timestamp\": 1567524492,\n \"txid\": \"55d87be458bd1a9aa960dd914b7f5c6d1b118d65d8b04477f705716d33091530\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"mh1BHTvud83u2YRfdb3PwYS29aVS36cZL7\",\n \"amount\": \"1.0\",\n \"claim_id\": \"69d710bbe991b5c96b4efd5339a16d85a2d89bc4\",\n \"claim_op\": \"create\",\n \"confirmations\": -2,\n \"height\": -2,\n \"meta\": {},\n \"name\": \"a-new-stream\",\n \"normalized_name\": \"a-new-stream\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://a-new-stream#69d710bbe991b5c96b4efd5339a16d85a2d89bc4\",\n \"timestamp\": null,\n \"txid\": \"406b4ea7584d40ab2f48ca553bd574ad04101df9beedc126ee519b0489425953\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmp_djode3_\",\n \"sd_hash\": \"cd64057a0fc233a5414c2f0d55ab806faafddc220c4544e9dd1b6acf750553ce29d615b463cd9fed21b4444d209db403\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"value_type\": \"stream\"\n },\n {\n \"address\": \"mjzLcPkJvG8GQgDFSW9X2iCFSkwAyF2NmP\",\n \"amount\": \"3.923448\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 1,\n \"timestamp\": null,\n \"txid\": \"406b4ea7584d40ab2f48ca553bd574ad04101df9beedc126ee519b0489425953\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.024107\",\n \"total_input\": \"4.947555\",\n \"total_output\": \"4.923448\",\n \"txid\": \"406b4ea7584d40ab2f48ca553bd574ad04101df9beedc126ee519b0489425953\"\n }\n}"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -241,10 +241,10 @@
|
||||
"examples": [
|
||||
{
|
||||
"title": "Resolve a claim",
|
||||
"curl": "curl -d'{\"method\": \"resolve\", \"params\": {\"urls\": [\"astream#68fde0328b1a267b3815ce974a6329b159619092\"]}}' http://localhost:5279/",
|
||||
"lbrynet": "lbrynet resolve astream#68fde0328b1a267b3815ce974a6329b159619092",
|
||||
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"resolve\", \"params\": {\"urls\": [\"astream#68fde0328b1a267b3815ce974a6329b159619092\"]}}).json()",
|
||||
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"astream#68fde0328b1a267b3815ce974a6329b159619092\": {\n \"address\": \"mhUNYMksuH5HFj2DUG1DsLAtMMaup1cgqn\",\n \"amount\": \"1.0\",\n \"canonical_url\": \"lbry://@channel#c/astream#6\",\n \"claim_id\": \"68fde0328b1a267b3815ce974a6329b159619092\",\n \"claim_op\": \"update\",\n \"confirmations\": 3,\n \"height\": 214,\n \"is_channel_signature_valid\": true,\n \"meta\": {\n \"activation_height\": 213,\n \"creation_height\": 213,\n \"creation_timestamp\": 1565587608,\n \"effective_amount\": \"1.0\",\n \"expiration_height\": 263187,\n \"is_controlling\": true,\n \"support_amount\": \"0.0\",\n \"take_over_height\": 213,\n \"trending_global\": 0.0,\n \"trending_group\": 0,\n \"trending_local\": 0.0,\n \"trending_mixed\": 0.0\n },\n \"name\": \"astream\",\n \"normalized_name\": \"astream\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://astream#68fde0328b1a267b3815ce974a6329b159619092\",\n \"short_url\": \"lbry://astream#6\",\n \"signing_channel\": {\n \"address\": \"mvE3pR2rH5mP1Hx8UEipnPt3Atp89tXqVw\",\n \"amount\": \"1.0\",\n \"canonical_url\": \"lbry://@channel#c\",\n \"claim_id\": \"cbf954c2782b7cf571f7aa1de960202057618727\",\n \"claim_op\": \"update\",\n \"confirmations\": 7,\n \"height\": 210,\n \"meta\": {\n \"activation_height\": 209,\n \"claims_in_channel\": 1,\n \"creation_height\": 209,\n \"creation_timestamp\": 1565587607,\n \"effective_amount\": \"1.0\",\n \"expiration_height\": 263183,\n \"is_controlling\": true,\n \"support_amount\": \"0.0\",\n \"take_over_height\": 209,\n \"trending_global\": 0.0,\n \"trending_group\": 0,\n \"trending_local\": 0.0,\n \"trending_mixed\": 0.0\n },\n \"name\": \"@channel\",\n \"normalized_name\": \"@channel\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://@channel#cbf954c2782b7cf571f7aa1de960202057618727\",\n \"short_url\": \"lbry://@channel#c\",\n \"timestamp\": 1565587607,\n \"txid\": \"794fc94e7ac645d5fc06c14e5ac9be9d9afa53cd540a349ee276662b23e21396\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a0342000404b644588c6a32f425fa8c2c3b0404898c79d405d1e90783adcf9a2bdbad505012f1e6be38f7837b69d5f2a1a1959135701780f01fc91c396158c4b1b9b1e304\",\n \"public_key_id\": \"mrPWGtFam2wwv7D1QRgXXrXePLqUGdKaCb\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n },\n \"timestamp\": 1565587608,\n \"txid\": \"55a247d733323e8645656c1c817ac34411fafb5493f9c528091897b6ca0e5400\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpwc0xotjc\",\n \"sd_hash\": \"ca7f2e83a2d275e25151463521e893b8812aa0b061ab299fb9877521c0a2ced15927eeca4f50680d8ea5e03ae6b6c3f2\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"value_type\": \"stream\"\n }\n }\n}"
|
||||
"curl": "curl -d'{\"method\": \"resolve\", \"params\": {\"urls\": [\"astream#bfb7d50e084d6d246ca9ff909c401aab30a6f9a6\"]}}' http://localhost:5279/",
|
||||
"lbrynet": "lbrynet resolve astream#bfb7d50e084d6d246ca9ff909c401aab30a6f9a6",
|
||||
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"resolve\", \"params\": {\"urls\": [\"astream#bfb7d50e084d6d246ca9ff909c401aab30a6f9a6\"]}}).json()",
|
||||
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"astream#bfb7d50e084d6d246ca9ff909c401aab30a6f9a6\": {\n \"address\": \"mqwocM9E8dcY9aHCaCGG6HXB8Pd3hA9KjF\",\n \"amount\": \"1.0\",\n \"canonical_url\": \"lbry://@channel#1/astream#b\",\n \"claim_id\": \"bfb7d50e084d6d246ca9ff909c401aab30a6f9a6\",\n \"claim_op\": \"update\",\n \"confirmations\": 3,\n \"height\": 214,\n \"is_channel_signature_valid\": true,\n \"meta\": {\n \"activation_height\": 213,\n \"creation_height\": 213,\n \"creation_timestamp\": 1567524492,\n \"effective_amount\": \"1.0\",\n \"expiration_height\": 263187,\n \"is_controlling\": true,\n \"support_amount\": \"0.0\",\n \"take_over_height\": 213,\n \"trending_global\": 0.0,\n \"trending_group\": 0,\n \"trending_local\": 0.0,\n \"trending_mixed\": 0.0\n },\n \"name\": \"astream\",\n \"normalized_name\": \"astream\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://astream#bfb7d50e084d6d246ca9ff909c401aab30a6f9a6\",\n \"short_url\": \"lbry://astream#b\",\n \"signing_channel\": {\n \"address\": \"mw6SpJDWJeYTWsr2iEFNEbRuqmNhDjpsZS\",\n \"amount\": \"1.0\",\n \"canonical_url\": \"lbry://@channel#1\",\n \"claim_id\": \"1812d3275894f62a055d59189a75698a071108af\",\n \"claim_op\": \"update\",\n \"confirmations\": 7,\n \"height\": 210,\n \"meta\": {\n \"activation_height\": 209,\n \"claims_in_channel\": 1,\n \"creation_height\": 209,\n \"creation_timestamp\": 1567524491,\n \"effective_amount\": \"1.0\",\n \"expiration_height\": 263183,\n \"is_controlling\": true,\n \"support_amount\": \"0.0\",\n \"take_over_height\": 209,\n \"trending_global\": 0.0,\n \"trending_group\": 0,\n \"trending_local\": 0.0,\n \"trending_mixed\": 0.0\n },\n \"name\": \"@channel\",\n \"normalized_name\": \"@channel\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://@channel#1812d3275894f62a055d59189a75698a071108af\",\n \"short_url\": \"lbry://@channel#1\",\n \"timestamp\": 1567524491,\n \"txid\": \"986dbf145a5320fe0047b3404216ddae76bb9e915895ebb04dda9c4e1b676be7\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a034200044974cd9d7098183f8bc9005f3957a4dbfc1ede19044311337fe9f645f256a7a4013c6a142497590bd8461fc50ce6b489453686422079c334bd5f8316b335365e\",\n \"public_key_id\": \"mrne5J4YN1SYYE3qNAAwzEVHAxnZX4AKHp\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n },\n \"timestamp\": 1567524492,\n \"txid\": \"f3338742c2b4cf0e35b7ffa73aea3e9da786926cf82f07d3100e09d04ec3f231\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpmjego0ff\",\n \"sd_hash\": \"2ab7bbd96cb5db43df9ff909c0555dd8a132866355768c41d24f2b4be7c0478ae5f82d2c853e95c9b1179c6743e4bb37\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"value_type\": \"stream\"\n }\n }\n}"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -266,7 +266,7 @@
|
||||
"curl": "curl -d'{\"method\": \"status\", \"params\": {}}' http://localhost:5279/",
|
||||
"lbrynet": "lbrynet status",
|
||||
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"status\", \"params\": {}}).json()",
|
||||
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"blob_manager\": {\n \"connections\": {\n \"incoming_bps\": {},\n \"outgoing_bps\": {},\n \"time\": 701000.371205916,\n \"total_incoming_mbs\": 0.0,\n \"total_outgoing_mbs\": 0.0,\n \"total_received\": 0,\n \"total_sent\": 0\n },\n \"finished_blobs\": 0\n },\n \"connection_status\": {\n \"code\": \"connected\",\n \"message\": \"No connection problems detected\"\n },\n \"installation_id\": \"7F6p1BEhFXF8nDAuREvQApa4s4iTVY4FnPAD3Hz9hhhfZGGDixA6otzvVXbuAeKwV\",\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\": \"be004973abe18bce798b4cd15ca2b2b684e84833a9b675ef660c214d46dbfecc\",\n \"blocks\": 206,\n \"blocks_behind\": 0,\n \"connected_servers\": [\n {\n \"host\": \"localhost\",\n \"latency\": 0,\n \"port\": 50002\n }\n ],\n \"is_encrypted\": false,\n \"is_locked\": false\n }\n }\n}"
|
||||
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"blob_manager\": {\n \"connections\": {\n \"incoming_bps\": {},\n \"outgoing_bps\": {},\n \"time\": 55995.711101459,\n \"total_incoming_mbs\": 0.0,\n \"total_outgoing_mbs\": 0.0,\n \"total_received\": 0,\n \"total_sent\": 0\n },\n \"finished_blobs\": 0\n },\n \"connection_status\": {\n \"code\": \"connected\",\n \"message\": \"No connection problems detected\"\n },\n \"installation_id\": \"7rrw8gej961zecjNyCJ6vFC1vMCZZ1tUsz5cYwrKNHn9VRVHECikd2eC47NZYEP7Bn\",\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\": \"4f4b0a8fd77284e1a83a05b9dfca0e5fdc337477caa94bd82239759512e5a27a\",\n \"blocks\": 206,\n \"blocks_behind\": 0,\n \"connected_servers\": [\n {\n \"host\": \"localhost\",\n \"latency\": 0.02,\n \"port\": 50002\n }\n ],\n \"is_encrypted\": false,\n \"is_locked\": false\n }\n }\n}"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -288,7 +288,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.38.7\",\n \"os_release\": \"4.4.0-116-generic\",\n \"os_system\": \"Linux\",\n \"platform\": \"Linux-4.4.0-116-generic-x86_64-with-Ubuntu-16.04-xenial\",\n \"processor\": \"x86_64\",\n \"python_version\": \"3.7.4\",\n \"torba_version\": \"0.5.7\"\n }\n}"
|
||||
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"build\": \"dev\",\n \"desktop\": \"GNOME\",\n \"distro\": {\n \"codename\": \"xenial\",\n \"id\": \"ubuntu\",\n \"like\": \"debian\",\n \"version\": \"16.04\",\n \"version_parts\": {\n \"build_number\": \"\",\n \"major\": \"16\",\n \"minor\": \"04\"\n }\n },\n \"lbrynet_version\": \"0.39.3\",\n \"os_release\": \"4.4.0-116-generic\",\n \"os_system\": \"Linux\",\n \"platform\": \"Linux-4.4.0-116-generic-x86_64-with-Ubuntu-16.04-xenial\",\n \"processor\": \"x86_64\",\n \"python_version\": \"3.7.4\",\n \"torba_version\": \"0.5.7\"\n }\n}"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -336,10 +336,10 @@
|
||||
"examples": [
|
||||
{
|
||||
"title": "Add an account from seed",
|
||||
"curl": "curl -d'{\"method\": \"account_add\", \"params\": {\"account_name\": \"new account\", \"seed\": \"foil sudden option various minor little coyote dolphin crouch crime belt bread\", \"single_key\": false}}' http://localhost:5279/",
|
||||
"lbrynet": "lbrynet account add \"new account\" --seed=\"foil sudden option various minor little coyote dolphin crouch crime belt bread\"",
|
||||
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"account_add\", \"params\": {\"account_name\": \"new account\", \"seed\": \"foil sudden option various minor little coyote dolphin crouch crime belt bread\", \"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\": \"n4S3djVrHvwjSyGvbqsJQRbMxz34ivbEmn\",\n \"is_default\": false,\n \"ledger\": \"lbc_regtest\",\n \"modified_on\": 1565587574.9123697,\n \"name\": \"new account\",\n \"private_key\": \"tprv8ZgxMBicQKsPdLfCBqeN8479gpUTYTm4KZjau4dYnkvMnquqU1KBPy3ueMmNQtwpPuesYacmYN9cmPSVrmGE2EwSXU5fsJHFKBVBDQ3Eh5i\",\n \"public_key\": \"tpubD6NzVbkrYhZ4Wogz5VJxXTmGFqzPhnwxtsLNBafrD2ikdLAc6Q8maTfmpUpL1Qr4dPKD6a3weHuSGyQLBthZBSFK6efbhw3WnvVVfSaCPM6\",\n \"seed\": \"foil sudden option various minor little coyote dolphin crouch crime belt bread\"\n }\n}"
|
||||
"curl": "curl -d'{\"method\": \"account_add\", \"params\": {\"account_name\": \"new account\", \"seed\": \"stadium call taxi myth power method puppy same subject second guess scrub\", \"single_key\": false}}' http://localhost:5279/",
|
||||
"lbrynet": "lbrynet account add \"new account\" --seed=\"stadium call taxi myth power method puppy same subject second guess scrub\"",
|
||||
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"account_add\", \"params\": {\"account_name\": \"new account\", \"seed\": \"stadium call taxi myth power method puppy same subject second guess scrub\", \"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\": \"mjnSjhq9hseBqH4SdLShwfWsPWmEvnFmBa\",\n \"is_default\": false,\n \"ledger\": \"lbc_regtest\",\n \"modified_on\": 1567524459.2594378,\n \"name\": \"new account\",\n \"private_key\": \"tprv8ZgxMBicQKsPecCYqVR6CJDGkdewMmh6YTxdi8Q6P4QUFUYVrc3uBVMnWTe9f2ZAMxMyDQiJ5DZd9bPw1SL6DyPmLRaPJ8KC6LVgVVyWG77\",\n \"public_key\": \"tpubD6NzVbkrYhZ4Y5ELj95gbhsPKfAsX6t17mZQzeSPoLCs5xoGUzsVMyyegZTamKHdJBPEPiK63GSKho6dV4DsfaE7n9LJuifHZZ5BZDUqWiJ\",\n \"seed\": \"stadium call taxi myth power method puppy same subject second guess scrub\"\n }\n}"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -377,9 +377,9 @@
|
||||
},
|
||||
{
|
||||
"title": "Get balance for specific account by id",
|
||||
"curl": "curl -d'{\"method\": \"account_balance\", \"params\": {\"account_id\": \"n4S3djVrHvwjSyGvbqsJQRbMxz34ivbEmn\", \"reserved_subtotals\": false}}' http://localhost:5279/",
|
||||
"lbrynet": "lbrynet account balance \"n4S3djVrHvwjSyGvbqsJQRbMxz34ivbEmn\"",
|
||||
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"account_balance\", \"params\": {\"account_id\": \"n4S3djVrHvwjSyGvbqsJQRbMxz34ivbEmn\", \"reserved_subtotals\": false}}).json()",
|
||||
"curl": "curl -d'{\"method\": \"account_balance\", \"params\": {\"account_id\": \"mjnSjhq9hseBqH4SdLShwfWsPWmEvnFmBa\", \"reserved_subtotals\": false}}' http://localhost:5279/",
|
||||
"lbrynet": "lbrynet account balance \"mjnSjhq9hseBqH4SdLShwfWsPWmEvnFmBa\"",
|
||||
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"account_balance\", \"params\": {\"account_id\": \"mjnSjhq9hseBqH4SdLShwfWsPWmEvnFmBa\", \"reserved_subtotals\": false}}).json()",
|
||||
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"available\": \"2.0\",\n \"reserved\": \"0.0\",\n \"reserved_subtotals\": null,\n \"total\": \"2.0\"\n }\n}"
|
||||
}
|
||||
]
|
||||
@@ -408,7 +408,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\": \"n4S3djVrHvwjSyGvbqsJQRbMxz34ivbEmn\",\n \"is_default\": false,\n \"ledger\": \"lbc_regtest\",\n \"modified_on\": 1565587574.7207406,\n \"name\": \"generated account\",\n \"private_key\": \"tprv8ZgxMBicQKsPdLfCBqeN8479gpUTYTm4KZjau4dYnkvMnquqU1KBPy3ueMmNQtwpPuesYacmYN9cmPSVrmGE2EwSXU5fsJHFKBVBDQ3Eh5i\",\n \"public_key\": \"tpubD6NzVbkrYhZ4Wogz5VJxXTmGFqzPhnwxtsLNBafrD2ikdLAc6Q8maTfmpUpL1Qr4dPKD6a3weHuSGyQLBthZBSFK6efbhw3WnvVVfSaCPM6\",\n \"seed\": \"foil sudden option various minor little coyote dolphin crouch crime belt bread\"\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\": \"mjnSjhq9hseBqH4SdLShwfWsPWmEvnFmBa\",\n \"is_default\": false,\n \"ledger\": \"lbc_regtest\",\n \"modified_on\": 1567524459.0664673,\n \"name\": \"generated account\",\n \"private_key\": \"tprv8ZgxMBicQKsPecCYqVR6CJDGkdewMmh6YTxdi8Q6P4QUFUYVrc3uBVMnWTe9f2ZAMxMyDQiJ5DZd9bPw1SL6DyPmLRaPJ8KC6LVgVVyWG77\",\n \"public_key\": \"tpubD6NzVbkrYhZ4Y5ELj95gbhsPKfAsX6t17mZQzeSPoLCs5xoGUzsVMyyegZTamKHdJBPEPiK63GSKho6dV4DsfaE7n9LJuifHZZ5BZDUqWiJ\",\n \"seed\": \"stadium call taxi myth power method puppy same subject second guess scrub\"\n }\n}"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -491,24 +491,24 @@
|
||||
"examples": [
|
||||
{
|
||||
"title": "Transfer 2 LBC from default account to specific account",
|
||||
"curl": "curl -d'{\"method\": \"account_fund\", \"params\": {\"to_account\": \"n4S3djVrHvwjSyGvbqsJQRbMxz34ivbEmn\", \"amount\": \"2.0\", \"everything\": false, \"broadcast\": true}}' http://localhost:5279/",
|
||||
"lbrynet": "lbrynet account fund --to_account=\"n4S3djVrHvwjSyGvbqsJQRbMxz34ivbEmn\" --amount=2.0 --broadcast",
|
||||
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"account_fund\", \"params\": {\"to_account\": \"n4S3djVrHvwjSyGvbqsJQRbMxz34ivbEmn\", \"amount\": \"2.0\", \"everything\": false, \"broadcast\": true}}).json()",
|
||||
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"0100000001d5f84e6eef616038f89f66af0d896f60fb28d0ce25785a3a8621da9fd74fecc6010000006a473044022071f23813260351722e31d85103c0d51728603138cd95f28ac471e6e025639b750220171676c27072102f314a70f102e24b68b8cc5e674564d8a2c4cce80ba809ebaa012103958c4d66bdbc04f4550e365b3b0d4060d4a58a35781c405c31f132d52510ee1fffffffff0200c2eb0b000000001976a914cc1a7b81fed46296749fca09ed76da07b3c0294688ac90d7ae2f000000001976a914d0d944552d385c36088c3c274ef4882821dc295088ac00000000\",\n \"inputs\": [\n {\n \"address\": \"mtHro6eY7d3n5JTM8tazct7DDRbJCUH2CX\",\n \"amount\": \"10.0\",\n \"confirmations\": 6,\n \"height\": 201,\n \"is_change\": false,\n \"is_mine\": true,\n \"nout\": 1,\n \"timestamp\": 1565587606,\n \"txid\": \"c6ec4fd79fda21863a5a7825ced028fb606f890daf669ff8386061ef6e4ef8d5\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"mz89sDjvPSJC4EUf8ssQm1wm2MfE5XtJYB\",\n \"amount\": \"2.0\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 0,\n \"timestamp\": null,\n \"txid\": \"0295fc060686b1872040214dabead8a042edbcc3a00f79580c27777841f5c504\",\n \"type\": \"payment\"\n },\n {\n \"address\": \"mzZF7vd3tBgh9u5tZcX2K4e4DipLzxt6d2\",\n \"amount\": \"7.999876\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 1,\n \"timestamp\": null,\n \"txid\": \"0295fc060686b1872040214dabead8a042edbcc3a00f79580c27777841f5c504\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.000124\",\n \"total_input\": \"10.0\",\n \"total_output\": \"9.999876\",\n \"txid\": \"0295fc060686b1872040214dabead8a042edbcc3a00f79580c27777841f5c504\"\n }\n}"
|
||||
"curl": "curl -d'{\"method\": \"account_fund\", \"params\": {\"to_account\": \"mjnSjhq9hseBqH4SdLShwfWsPWmEvnFmBa\", \"amount\": \"2.0\", \"everything\": false, \"broadcast\": true}}' http://localhost:5279/",
|
||||
"lbrynet": "lbrynet account fund --to_account=\"mjnSjhq9hseBqH4SdLShwfWsPWmEvnFmBa\" --amount=2.0 --broadcast",
|
||||
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"account_fund\", \"params\": {\"to_account\": \"mjnSjhq9hseBqH4SdLShwfWsPWmEvnFmBa\", \"amount\": \"2.0\", \"everything\": false, \"broadcast\": true}}).json()",
|
||||
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"01000000012d1508ed14fd8d62d75cdb57eabe66364d3a769b89517299cc2f0eb8e42ab479010000006b483045022100f3a6ef432adc9b3e04a21da7adb15dd035cb8598355801923430a4e0f163693e0220087f7a751a3d368bb9ef92069f686bac41e972ed18632e448693e8418533fef9012102ec6d1f6c1bc6b026357f87f3d6afdeb71fd1e15bc8f2f0752ed1656281aaf4d3ffffffff0200c2eb0b000000001976a9148167e7add764797c9cdc98552e401133a96a932588ac90d7ae2f000000001976a9149b95cc2634f683041cca56112526caeeed97183188ac00000000\",\n \"inputs\": [\n {\n \"address\": \"n4Xag4N3ZDjuhwCLRqifkiSEEQP6PpV36S\",\n \"amount\": \"10.0\",\n \"confirmations\": 6,\n \"height\": 201,\n \"is_change\": false,\n \"is_mine\": true,\n \"nout\": 1,\n \"timestamp\": 1567524490,\n \"txid\": \"79b42ae4b80e2fcc997251899b763a4d3666beea57db5cd7628dfd14ed08152d\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"msKBwFDKRQGiCfXo8QmdDtfen9FcFYfgaQ\",\n \"amount\": \"2.0\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 0,\n \"timestamp\": null,\n \"txid\": \"3e770eda0c2cc8b74e0107e6395fc686a08e022814f55a8153f83fb0f5f923ab\",\n \"type\": \"payment\"\n },\n {\n \"address\": \"muhcUu1j1b5TrfvnsrMJ68CAUA9hahXHZH\",\n \"amount\": \"7.999876\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 1,\n \"timestamp\": null,\n \"txid\": \"3e770eda0c2cc8b74e0107e6395fc686a08e022814f55a8153f83fb0f5f923ab\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.000124\",\n \"total_input\": \"10.0\",\n \"total_output\": \"9.999876\",\n \"txid\": \"3e770eda0c2cc8b74e0107e6395fc686a08e022814f55a8153f83fb0f5f923ab\"\n }\n}"
|
||||
},
|
||||
{
|
||||
"title": "Spread LBC between multiple addresses",
|
||||
"curl": "curl -d'{\"method\": \"account_fund\", \"params\": {\"to_account\": \"n4S3djVrHvwjSyGvbqsJQRbMxz34ivbEmn\", \"from_account\": \"n4S3djVrHvwjSyGvbqsJQRbMxz34ivbEmn\", \"amount\": \"1.5\", \"everything\": false, \"outputs\": 2, \"broadcast\": true}}' http://localhost:5279/",
|
||||
"lbrynet": "lbrynet account fund --to_account=\"n4S3djVrHvwjSyGvbqsJQRbMxz34ivbEmn\" --from_account=\"n4S3djVrHvwjSyGvbqsJQRbMxz34ivbEmn\" --amount=1.5 --outputs=2 --broadcast",
|
||||
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"account_fund\", \"params\": {\"to_account\": \"n4S3djVrHvwjSyGvbqsJQRbMxz34ivbEmn\", \"from_account\": \"n4S3djVrHvwjSyGvbqsJQRbMxz34ivbEmn\", \"amount\": \"1.5\", \"everything\": false, \"outputs\": 2, \"broadcast\": true}}).json()",
|
||||
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"010000000104c5f5417877270c58790fa0c3bced42a0d8eaab4d21402087b1860606fc9502000000006a47304402201459cd01251fc2750e9c83a3bbdd3de9cb5957e854590ddc47abc553a2f5d6be02203531aea3e6c076e6a08f28522c922eee0052e18fc4e1bf0da24dcdb33a3a43f3012102d231cd354ed3c2b299a7fd1abf77c4ab67d23f5e72739ee5ca26f2dc5737cc6cffffffff03c0687804000000001976a914be409698cb18d21048c6dca40c68fe7c0681c9fd88acc0687804000000001976a914be409698cb18d21048c6dca40c68fe7c0681c9fd88ac6cb9fa02000000001976a914cc1a7b81fed46296749fca09ed76da07b3c0294688ac00000000\",\n \"inputs\": [\n {\n \"address\": \"mz89sDjvPSJC4EUf8ssQm1wm2MfE5XtJYB\",\n \"amount\": \"2.0\",\n \"confirmations\": 1,\n \"height\": 207,\n \"is_change\": true,\n \"is_mine\": true,\n \"nout\": 0,\n \"timestamp\": 1565587607,\n \"txid\": \"0295fc060686b1872040214dabead8a042edbcc3a00f79580c27777841f5c504\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"mxrv4B1aGmVMitNA2heEDr62sAGdyYA8ZZ\",\n \"amount\": \"0.75\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 0,\n \"timestamp\": null,\n \"txid\": \"5e610622fdb215cdeb29abdcb2d8835e4049dd7a488b5df3f181051a7daf6a86\",\n \"type\": \"payment\"\n },\n {\n \"address\": \"mxrv4B1aGmVMitNA2heEDr62sAGdyYA8ZZ\",\n \"amount\": \"0.75\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 1,\n \"timestamp\": null,\n \"txid\": \"5e610622fdb215cdeb29abdcb2d8835e4049dd7a488b5df3f181051a7daf6a86\",\n \"type\": \"payment\"\n },\n {\n \"address\": \"mz89sDjvPSJC4EUf8ssQm1wm2MfE5XtJYB\",\n \"amount\": \"0.499859\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 2,\n \"timestamp\": null,\n \"txid\": \"5e610622fdb215cdeb29abdcb2d8835e4049dd7a488b5df3f181051a7daf6a86\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.000141\",\n \"total_input\": \"2.0\",\n \"total_output\": \"1.999859\",\n \"txid\": \"5e610622fdb215cdeb29abdcb2d8835e4049dd7a488b5df3f181051a7daf6a86\"\n }\n}"
|
||||
"curl": "curl -d'{\"method\": \"account_fund\", \"params\": {\"to_account\": \"mjnSjhq9hseBqH4SdLShwfWsPWmEvnFmBa\", \"from_account\": \"mjnSjhq9hseBqH4SdLShwfWsPWmEvnFmBa\", \"amount\": \"1.5\", \"everything\": false, \"outputs\": 2, \"broadcast\": true}}' http://localhost:5279/",
|
||||
"lbrynet": "lbrynet account fund --to_account=\"mjnSjhq9hseBqH4SdLShwfWsPWmEvnFmBa\" --from_account=\"mjnSjhq9hseBqH4SdLShwfWsPWmEvnFmBa\" --amount=1.5 --outputs=2 --broadcast",
|
||||
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"account_fund\", \"params\": {\"to_account\": \"mjnSjhq9hseBqH4SdLShwfWsPWmEvnFmBa\", \"from_account\": \"mjnSjhq9hseBqH4SdLShwfWsPWmEvnFmBa\", \"amount\": \"1.5\", \"everything\": false, \"outputs\": 2, \"broadcast\": true}}).json()",
|
||||
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"0100000001ab23f9f5b03ff853815af51428028ea086c65f39e607014eb7c82c0cda0e773e000000006a47304402200350e8549f476fe19c82ae814b96f3a3ab245f282010921bf6c8808b8cccba3302204000cf0fdc08420886919665206785fd910fdbd4d72be6325914469912bb0c4301210219ba33f16de9b9f8b551dcd3dc932a174229075302103213a0f83a3c63df7646ffffffff03c0687804000000001976a9140d9b85fa9ecda29ba36b96cddf78b033c469a0fa88acc0687804000000001976a9140d9b85fa9ecda29ba36b96cddf78b033c469a0fa88ac6cb9fa02000000001976a9147e318c3fb101eb541c5e62fe98998ad294cb27f088ac00000000\",\n \"inputs\": [\n {\n \"address\": \"msKBwFDKRQGiCfXo8QmdDtfen9FcFYfgaQ\",\n \"amount\": \"2.0\",\n \"confirmations\": 1,\n \"height\": 207,\n \"is_change\": true,\n \"is_mine\": true,\n \"nout\": 0,\n \"timestamp\": 1567524491,\n \"txid\": \"3e770eda0c2cc8b74e0107e6395fc686a08e022814f55a8153f83fb0f5f923ab\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"mgkuPVxE2UwWfLr26kLT1QAEiYScvMohPs\",\n \"amount\": \"0.75\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 0,\n \"timestamp\": null,\n \"txid\": \"a47c8cb42a3920e7fedbf143b6cb3409d16ac85660abf7fc7892804783858f72\",\n \"type\": \"payment\"\n },\n {\n \"address\": \"mgkuPVxE2UwWfLr26kLT1QAEiYScvMohPs\",\n \"amount\": \"0.75\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 1,\n \"timestamp\": null,\n \"txid\": \"a47c8cb42a3920e7fedbf143b6cb3409d16ac85660abf7fc7892804783858f72\",\n \"type\": \"payment\"\n },\n {\n \"address\": \"ms2CnsNwPX42NZjkYt3kTF4JfpuSxhmjHj\",\n \"amount\": \"0.499859\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 2,\n \"timestamp\": null,\n \"txid\": \"a47c8cb42a3920e7fedbf143b6cb3409d16ac85660abf7fc7892804783858f72\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.000141\",\n \"total_input\": \"2.0\",\n \"total_output\": \"1.999859\",\n \"txid\": \"a47c8cb42a3920e7fedbf143b6cb3409d16ac85660abf7fc7892804783858f72\"\n }\n}"
|
||||
},
|
||||
{
|
||||
"title": "Transfer all LBC to a specified account",
|
||||
"curl": "curl -d'{\"method\": \"account_fund\", \"params\": {\"from_account\": \"n4S3djVrHvwjSyGvbqsJQRbMxz34ivbEmn\", \"everything\": true, \"broadcast\": true}}' http://localhost:5279/",
|
||||
"lbrynet": "lbrynet account fund --from_account=\"n4S3djVrHvwjSyGvbqsJQRbMxz34ivbEmn\" --everything --broadcast",
|
||||
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"account_fund\", \"params\": {\"from_account\": \"n4S3djVrHvwjSyGvbqsJQRbMxz34ivbEmn\", \"everything\": true, \"broadcast\": true}}).json()",
|
||||
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"0100000003866aaf7d1a0581f1f35d8b487add49405e83d8b2dcab29ebcd15b2fd2206615e000000006b483045022100a6eb574aa0826f6a2943549835f68e6da03d6fe005f66989f4fdc4b5a87a42af022019269d1ffa052179326fe9ea336ece04a8321eb543a99248126d1f7f3976c7a8012103eae283e24169f92a68ccc2c9aefed407c144af652c3fe5f4f5df95d69b01c427ffffffff866aaf7d1a0581f1f35d8b487add49405e83d8b2dcab29ebcd15b2fd2206615e010000006b483045022100f07f0f7e2174e12dd75d649ffba4291ac5aac9705f0d3498e291c262abed9fa6022004a75bc29cbe593e3156ec5fc162e1ec61fd96e0870ed788de808b0babeb5064012103eae283e24169f92a68ccc2c9aefed407c144af652c3fe5f4f5df95d69b01c427ffffffff866aaf7d1a0581f1f35d8b487add49405e83d8b2dcab29ebcd15b2fd2206615e020000006a47304402207d3881bad363a319b9dc7a95c9e72863cd517460d5d9d537c0cee3a66bdbf58a022024d658e7103fe09b99886c41df404982894a698eaf10fca61e40a18910b78586012102d231cd354ed3c2b299a7fd1abf77c4ab67d23f5e72739ee5ca26f2dc5737cc6cffffffff015027eb0b000000001976a91471fcf6203f6070ab92a123cd4db621933ec98f8588ac00000000\",\n \"inputs\": [\n {\n \"address\": \"mxrv4B1aGmVMitNA2heEDr62sAGdyYA8ZZ\",\n \"amount\": \"0.75\",\n \"confirmations\": 1,\n \"height\": 208,\n \"is_change\": true,\n \"is_mine\": true,\n \"nout\": 0,\n \"timestamp\": 1565587607,\n \"txid\": \"5e610622fdb215cdeb29abdcb2d8835e4049dd7a488b5df3f181051a7daf6a86\",\n \"type\": \"payment\"\n },\n {\n \"address\": \"mxrv4B1aGmVMitNA2heEDr62sAGdyYA8ZZ\",\n \"amount\": \"0.75\",\n \"confirmations\": 1,\n \"height\": 208,\n \"is_change\": true,\n \"is_mine\": true,\n \"nout\": 1,\n \"timestamp\": 1565587607,\n \"txid\": \"5e610622fdb215cdeb29abdcb2d8835e4049dd7a488b5df3f181051a7daf6a86\",\n \"type\": \"payment\"\n },\n {\n \"address\": \"mz89sDjvPSJC4EUf8ssQm1wm2MfE5XtJYB\",\n \"amount\": \"0.499859\",\n \"confirmations\": 1,\n \"height\": 208,\n \"is_change\": true,\n \"is_mine\": true,\n \"nout\": 2,\n \"timestamp\": 1565587607,\n \"txid\": \"5e610622fdb215cdeb29abdcb2d8835e4049dd7a488b5df3f181051a7daf6a86\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"mqufgoJUGVmpBPShNwTYNrAa34mYcS2BAZ\",\n \"amount\": \"1.999604\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 0,\n \"timestamp\": null,\n \"txid\": \"8031b6e9e96d47669b502810414618430bc3589ffb2e9fd18a130692842909cd\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.000255\",\n \"total_input\": \"1.999859\",\n \"total_output\": \"1.999604\",\n \"txid\": \"8031b6e9e96d47669b502810414618430bc3589ffb2e9fd18a130692842909cd\"\n }\n}"
|
||||
"curl": "curl -d'{\"method\": \"account_fund\", \"params\": {\"from_account\": \"mjnSjhq9hseBqH4SdLShwfWsPWmEvnFmBa\", \"everything\": true, \"broadcast\": true}}' http://localhost:5279/",
|
||||
"lbrynet": "lbrynet account fund --from_account=\"mjnSjhq9hseBqH4SdLShwfWsPWmEvnFmBa\" --everything --broadcast",
|
||||
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"account_fund\", \"params\": {\"from_account\": \"mjnSjhq9hseBqH4SdLShwfWsPWmEvnFmBa\", \"everything\": true, \"broadcast\": true}}).json()",
|
||||
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"0100000003728f858347809278fcf7ab6056c86ad10934cbb643f1dbfee720392ab48c7ca4000000006a473044022067b37bffa018c7b54e862ce8ea6d3703718adb44a842f7acf3d8f8f38e45bdac02206c528df2c07d2301710935307530b31f6bd0864c135edeaa64246c6a8455645c012102ca78e33e37a6662255c12842d8ac4d89b2a6432f36fe37ab9de5a81f170aa339ffffffff728f858347809278fcf7ab6056c86ad10934cbb643f1dbfee720392ab48c7ca4010000006b483045022100a61a3687a73245222c16bd975518bef97bd6d975dfe5ad3eea0c935198bf1dad02207880a83ff7d52e14ad78f7ce99fa8b11d4940f33ffc6f27907940cc417b4e36b012102ca78e33e37a6662255c12842d8ac4d89b2a6432f36fe37ab9de5a81f170aa339ffffffff728f858347809278fcf7ab6056c86ad10934cbb643f1dbfee720392ab48c7ca4020000006b483045022100f46d51067598e68e9905da461175e1a5b73df742d8e073021226114fe44b772e022005c2f8e881571cbbe112f054ff6856d603b6bf621403ef0f82ea0dda836082940121028724b5be2ae3ba6b54c90e3ad283fcd211763bf81dbf15c97c166130628e3a0fffffffff015027eb0b000000001976a9146f15a545a6b6c030fb255447274e2e996be89f4688ac00000000\",\n \"inputs\": [\n {\n \"address\": \"mgkuPVxE2UwWfLr26kLT1QAEiYScvMohPs\",\n \"amount\": \"0.75\",\n \"confirmations\": 1,\n \"height\": 208,\n \"is_change\": true,\n \"is_mine\": true,\n \"nout\": 0,\n \"timestamp\": 1567524491,\n \"txid\": \"a47c8cb42a3920e7fedbf143b6cb3409d16ac85660abf7fc7892804783858f72\",\n \"type\": \"payment\"\n },\n {\n \"address\": \"mgkuPVxE2UwWfLr26kLT1QAEiYScvMohPs\",\n \"amount\": \"0.75\",\n \"confirmations\": 1,\n \"height\": 208,\n \"is_change\": true,\n \"is_mine\": true,\n \"nout\": 1,\n \"timestamp\": 1567524491,\n \"txid\": \"a47c8cb42a3920e7fedbf143b6cb3409d16ac85660abf7fc7892804783858f72\",\n \"type\": \"payment\"\n },\n {\n \"address\": \"ms2CnsNwPX42NZjkYt3kTF4JfpuSxhmjHj\",\n \"amount\": \"0.499859\",\n \"confirmations\": 1,\n \"height\": 208,\n \"is_change\": true,\n \"is_mine\": true,\n \"nout\": 2,\n \"timestamp\": 1567524491,\n \"txid\": \"a47c8cb42a3920e7fedbf143b6cb3409d16ac85660abf7fc7892804783858f72\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"mqeKEJuCipt8ArNwvnd9Ed2mpdVSKFjFPf\",\n \"amount\": \"1.999604\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 0,\n \"timestamp\": null,\n \"txid\": \"44f8291dfc8ca34a42469e945f4aa86fbab08ec9780dce8f340e6cfb3362442c\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.000255\",\n \"total_input\": \"1.999859\",\n \"total_output\": \"1.999604\",\n \"txid\": \"44f8291dfc8ca34a42469e945f4aa86fbab08ec9780dce8f340e6cfb3362442c\"\n }\n}"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -548,7 +548,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\": \"miXe7ZYokTt1eKNnrf1FtgQHoK4fPCkjuR\",\n \"is_default\": true,\n \"name\": \"Account #miXe7ZYokTt1eKNnrf1FtgQHoK4fPCkjuR\",\n \"public_key\": \"tpubD6NzVbkrYhZ4WdMUNwhAxYY17XGDHf8BmBaqLcoX8Ykr879yEy8TpvzeC9GFvjZTfAd7cxF5epgfoBBK63DsdKgHW4aR4WF7aNLpKsx2nM7\",\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\": \"mrsZujEBWo4WRGRu1hx6uogoqDiAdbef3b\",\n \"is_default\": true,\n \"name\": \"Account #mrsZujEBWo4WRGRu1hx6uogoqDiAdbef3b\",\n \"preferences\": {\n \"theme\": \"dark\"\n },\n \"public_key\": \"tpubD6NzVbkrYhZ4Wjno2VHeqwKLRQZRWBYQ18z41xq9oPBfRWL76diN4VUBTbUGVEgpXG1pUoD9nDgZszYJLM2uVZAK1tFtke3VXiEmk6BnsD2\",\n \"satoshis\": 1000000000\n }\n ]\n }\n}"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -595,10 +595,10 @@
|
||||
"examples": [
|
||||
{
|
||||
"title": "Remove an account",
|
||||
"curl": "curl -d'{\"method\": \"account_remove\", \"params\": {\"account_id\": \"n4S3djVrHvwjSyGvbqsJQRbMxz34ivbEmn\"}}' http://localhost:5279/",
|
||||
"lbrynet": "lbrynet account remove n4S3djVrHvwjSyGvbqsJQRbMxz34ivbEmn",
|
||||
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"account_remove\", \"params\": {\"account_id\": \"n4S3djVrHvwjSyGvbqsJQRbMxz34ivbEmn\"}}).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\": \"n4S3djVrHvwjSyGvbqsJQRbMxz34ivbEmn\",\n \"is_default\": false,\n \"ledger\": \"lbc_regtest\",\n \"modified_on\": 1565587574.7207406,\n \"name\": \"generated account\",\n \"private_key\": \"tprv8ZgxMBicQKsPdLfCBqeN8479gpUTYTm4KZjau4dYnkvMnquqU1KBPy3ueMmNQtwpPuesYacmYN9cmPSVrmGE2EwSXU5fsJHFKBVBDQ3Eh5i\",\n \"public_key\": \"tpubD6NzVbkrYhZ4Wogz5VJxXTmGFqzPhnwxtsLNBafrD2ikdLAc6Q8maTfmpUpL1Qr4dPKD6a3weHuSGyQLBthZBSFK6efbhw3WnvVVfSaCPM6\",\n \"seed\": \"foil sudden option various minor little coyote dolphin crouch crime belt bread\"\n }\n}"
|
||||
"curl": "curl -d'{\"method\": \"account_remove\", \"params\": {\"account_id\": \"mjnSjhq9hseBqH4SdLShwfWsPWmEvnFmBa\"}}' http://localhost:5279/",
|
||||
"lbrynet": "lbrynet account remove mjnSjhq9hseBqH4SdLShwfWsPWmEvnFmBa",
|
||||
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"account_remove\", \"params\": {\"account_id\": \"mjnSjhq9hseBqH4SdLShwfWsPWmEvnFmBa\"}}).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\": \"mjnSjhq9hseBqH4SdLShwfWsPWmEvnFmBa\",\n \"is_default\": false,\n \"ledger\": \"lbc_regtest\",\n \"modified_on\": 1567524459.0664673,\n \"name\": \"generated account\",\n \"private_key\": \"tprv8ZgxMBicQKsPecCYqVR6CJDGkdewMmh6YTxdi8Q6P4QUFUYVrc3uBVMnWTe9f2ZAMxMyDQiJ5DZd9bPw1SL6DyPmLRaPJ8KC6LVgVVyWG77\",\n \"public_key\": \"tpubD6NzVbkrYhZ4Y5ELj95gbhsPKfAsX6t17mZQzeSPoLCs5xoGUzsVMyyegZTamKHdJBPEPiK63GSKho6dV4DsfaE7n9LJuifHZZ5BZDUqWiJ\",\n \"seed\": \"stadium call taxi myth power method puppy same subject second guess scrub\"\n }\n}"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -673,10 +673,10 @@
|
||||
"examples": [
|
||||
{
|
||||
"title": "Modify maximum number of times a change address can be reused",
|
||||
"curl": "curl -d'{\"method\": \"account_set\", \"params\": {\"account_id\": \"n4S3djVrHvwjSyGvbqsJQRbMxz34ivbEmn\", \"default\": false, \"change_max_uses\": 10}}' http://localhost:5279/",
|
||||
"lbrynet": "lbrynet account set n4S3djVrHvwjSyGvbqsJQRbMxz34ivbEmn --change_max_uses=10",
|
||||
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"account_set\", \"params\": {\"account_id\": \"n4S3djVrHvwjSyGvbqsJQRbMxz34ivbEmn\", \"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\": \"n4S3djVrHvwjSyGvbqsJQRbMxz34ivbEmn\",\n \"is_default\": false,\n \"ledger\": \"lbc_regtest\",\n \"modified_on\": 1565587575.0091093,\n \"name\": \"new account\",\n \"private_key\": \"tprv8ZgxMBicQKsPdLfCBqeN8479gpUTYTm4KZjau4dYnkvMnquqU1KBPy3ueMmNQtwpPuesYacmYN9cmPSVrmGE2EwSXU5fsJHFKBVBDQ3Eh5i\",\n \"public_key\": \"tpubD6NzVbkrYhZ4Wogz5VJxXTmGFqzPhnwxtsLNBafrD2ikdLAc6Q8maTfmpUpL1Qr4dPKD6a3weHuSGyQLBthZBSFK6efbhw3WnvVVfSaCPM6\",\n \"seed\": \"foil sudden option various minor little coyote dolphin crouch crime belt bread\"\n }\n}"
|
||||
"curl": "curl -d'{\"method\": \"account_set\", \"params\": {\"account_id\": \"mjnSjhq9hseBqH4SdLShwfWsPWmEvnFmBa\", \"default\": false, \"change_max_uses\": 10}}' http://localhost:5279/",
|
||||
"lbrynet": "lbrynet account set mjnSjhq9hseBqH4SdLShwfWsPWmEvnFmBa --change_max_uses=10",
|
||||
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"account_set\", \"params\": {\"account_id\": \"mjnSjhq9hseBqH4SdLShwfWsPWmEvnFmBa\", \"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\": \"mjnSjhq9hseBqH4SdLShwfWsPWmEvnFmBa\",\n \"is_default\": false,\n \"ledger\": \"lbc_regtest\",\n \"modified_on\": 1567524459.3661392,\n \"name\": \"new account\",\n \"private_key\": \"tprv8ZgxMBicQKsPecCYqVR6CJDGkdewMmh6YTxdi8Q6P4QUFUYVrc3uBVMnWTe9f2ZAMxMyDQiJ5DZd9bPw1SL6DyPmLRaPJ8KC6LVgVVyWG77\",\n \"public_key\": \"tpubD6NzVbkrYhZ4Y5ELj95gbhsPKfAsX6t17mZQzeSPoLCs5xoGUzsVMyyegZTamKHdJBPEPiK63GSKho6dV4DsfaE7n9LJuifHZZ5BZDUqWiJ\",\n \"seed\": \"stadium call taxi myth power method puppy same subject second guess scrub\"\n }\n}"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -726,9 +726,9 @@
|
||||
"examples": [
|
||||
{
|
||||
"title": "Check if address is mine",
|
||||
"curl": "curl -d'{\"method\": \"address_is_mine\", \"params\": {\"address\": \"mnQSixa4Pxn1udNR8HyBCdjC5TeBaq8TWN\"}}' http://localhost:5279/",
|
||||
"lbrynet": "lbrynet address is_mine mnQSixa4Pxn1udNR8HyBCdjC5TeBaq8TWN",
|
||||
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"address_is_mine\", \"params\": {\"address\": \"mnQSixa4Pxn1udNR8HyBCdjC5TeBaq8TWN\"}}).json()",
|
||||
"curl": "curl -d'{\"method\": \"address_is_mine\", \"params\": {\"address\": \"mh1BHTvud83u2YRfdb3PwYS29aVS36cZL7\"}}' http://localhost:5279/",
|
||||
"lbrynet": "lbrynet address is_mine mh1BHTvud83u2YRfdb3PwYS29aVS36cZL7",
|
||||
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"address_is_mine\", \"params\": {\"address\": \"mh1BHTvud83u2YRfdb3PwYS29aVS36cZL7\"}}).json()",
|
||||
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": true\n}"
|
||||
}
|
||||
]
|
||||
@@ -763,14 +763,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 \"mwzLgEMMmoR18v3a9wycimU2HpH1C5zjuC\",\n \"mqufgoJUGVmpBPShNwTYNrAa34mYcS2BAZ\",\n \"mzZF7vd3tBgh9u5tZcX2K4e4DipLzxt6d2\",\n \"mq426NVsa1ktHvAxmzZGjiv6vr8JYkpWBR\",\n \"n19NX4hFThAvep5r78VhPh4rL9syV9WDrP\",\n \"mmP7gjMxMuixG5QWRku97zMaVp2YvmKwkA\",\n \"mtHro6eY7d3n5JTM8tazct7DDRbJCUH2CX\",\n \"mw78ij63SuKiP4PLKDXALWiXGyD5Wzoy9o\",\n \"mnjnSTckKVTLbFLjxWqpyerpHp8kB9vGvJ\",\n \"mrM93XmQAYUDH7Mw8E1JA4FFNgnAf8HR5C\",\n \"n1qfvnMjq54N8VZ6Lo9PHJqZnURANLnhuG\",\n \"my6rN6hjATred59RrMsADDPKjnetgZsUWA\",\n \"mhUNYMksuH5HFj2DUG1DsLAtMMaup1cgqn\",\n \"mvE3pR2rH5mP1Hx8UEipnPt3Atp89tXqVw\",\n \"mnQSixa4Pxn1udNR8HyBCdjC5TeBaq8TWN\",\n \"mk9QmTXDuQyUFkMhUvLrtyJhEksBXh1Azm\",\n \"mkHmFi637aQsZiYyjNSxXoBtHT9dyU924g\",\n \"mpQfor4a7VZ6AJkhUdA48pgEci4HoD7yz9\",\n \"mhPFLtT7YzmNfMuQYr4PQXAJdtaTKWRLFy\",\n \"mndiWiLpZa1v3WXtJKm1L9q93NysqCDvTU\",\n \"mucDX1B3gHcx791XgqFZCEbJSQ8pisdw8y\",\n \"mub8LSJ2vtxffDfKb2njq4ggVpDnNwzYBY\",\n \"mhnAE4ok1uVP5mkJaB5pn14Ni84aiX18rw\",\n \"n4HMxe8Q2kV3QKjs6cdixKEHdMHgFwtozB\",\n \"n1JZES3jZNKN93DjLJ6LgkYPmHFuPcZcPD\",\n \"my7Rw5wknudwjZn3obGMMaXPAe6wJcq9JN\",\n \"mqe7hTdNWrqTw2wANj4d5mxKqWBYixqxmL\"\n ]\n}"
|
||||
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": [\n \"n4Xag4N3ZDjuhwCLRqifkiSEEQP6PpV36S\",\n \"mpXqw4ekUeJnVt4HUVaUosdMRHckFLpJCV\",\n \"mmKg1fn6nmGHvnTWGz68nxRPUZwCYRkAsD\",\n \"mh1BHTvud83u2YRfdb3PwYS29aVS36cZL7\",\n \"mgMzHjZQAVJBJhYMu4VxKM6kR5SLY4gdDD\",\n \"mqwocM9E8dcY9aHCaCGG6HXB8Pd3hA9KjF\",\n \"mg7RyLK5N2dbdPjeWD2fVr4dTcyavw2Ct2\",\n \"myCuq56SrV2pce92Dm3Nzbe6tm9r46tpEE\",\n \"mw6SpJDWJeYTWsr2iEFNEbRuqmNhDjpsZS\",\n \"n1T7bqxpN2a4Jhy2v4D8S5Z9mU3U4vxLCX\",\n \"mqK5dgq7NbPAAuxC9r86xDrtW2fqz52q4X\",\n \"mrTCKDBAm6E2j3hY1paCRtguSvR9YMjavH\",\n \"mjV34bsrCzmSJdrN93jaAWurkc9TaPBEis\",\n \"n4GBt198ctM4KF1AJGJG8ppxAeFyXFfut9\",\n \"mmpdMa9REnAKFcB53jWjbTbLbXwXcXkNd2\",\n \"myLteN944rTScB8AM9NpmA5qbDvnWNXbNY\",\n \"mg5JJDDtptTPX44PiUibpByPeyMr3tmTL8\",\n \"miCcFsZ8btLRMVDh5eS6einqWKvW5Fd6Nw\",\n \"mw9NWnxosCDEqtGZbdw7u9rnVXcXFQLpJk\",\n \"mpwknBXErVReLTFbGUaDYuJeEpdY8hmw5x\",\n \"mqeKEJuCipt8ArNwvnd9Ed2mpdVSKFjFPf\",\n \"mk7Hr34G619JQ1wzFNRun1zWp9c8PLq7ze\",\n \"mvHTTahf6ZHHUJyEMpAXCDRQrvtSq2jAxZ\",\n \"mxHmETLREWiKKZGbekHYJZLYbCVPvZ3kjX\",\n \"mzQFLzaXkTU6oki1wqikNixwngsBuMjQZG\",\n \"muhcUu1j1b5TrfvnsrMJ68CAUA9hahXHZH\",\n \"mfpDwgCS4TpWdAaMJUpgxFkv2Jw78X8MpL\"\n ]\n}"
|
||||
},
|
||||
{
|
||||
"title": "List addresses in specified account",
|
||||
"curl": "curl -d'{\"method\": \"address_list\", \"params\": {\"account_id\": \"n4S3djVrHvwjSyGvbqsJQRbMxz34ivbEmn\"}}' http://localhost:5279/",
|
||||
"lbrynet": "lbrynet address list --account_id=\"n4S3djVrHvwjSyGvbqsJQRbMxz34ivbEmn\"",
|
||||
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"address_list\", \"params\": {\"account_id\": \"n4S3djVrHvwjSyGvbqsJQRbMxz34ivbEmn\"}}).json()",
|
||||
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": [\n \"mwbmGcWxWP62u8WJL1sabaDUrRWgfvZnDJ\",\n \"n4H8Bq2pqGaMYcLVUB4RnySHuQYHebehYF\",\n \"n17pcmUBzURU1iLPn3gJ2TjkobTRKEkjeg\",\n \"mg4cT3trLybfa1kiKi7pWmAPQiSDRjvqnv\",\n \"mnN6tv9823EM2H2TLs4iKUirbzHRe31Gzn\",\n \"mpoHe8Efc7DMqjj7ZDHR9KmLDDNgUEiEji\",\n \"n16ExP69CXjmrcLGjE4RB6BWnKpnxyJqpa\",\n \"n1kjh2tsLf9s7q1frrqjaBoD42SNe12cJX\",\n \"n1Fa3zdSYy4T7p6348FWVzXxvdU1taWYVU\",\n \"mvZau2hafjNSf2Foit4PTmnFsHEug2aRqs\",\n \"mj4tVqn9EEkbodxvD9WBMms4ZJL5eiKExX\",\n \"mg7MQFATWXeASZSqK7LjXMnbmE5mirtUU6\",\n \"mwzd69pjQGZgC17L5Eth5nHQf468oP82wS\",\n \"mxfbMjeJVDgbTRVNYxGqcMGFoUKdczARmU\",\n \"mxU51ochtL3GwcfvgSuiUEY21EAvctJPJB\",\n \"mvQ1dMX2dJQ2z6rAfwGPoxeokfeRFGUeHC\",\n \"mnQWsVSPR23HNYzA5zsGTq6DYGgyYCVNZE\",\n \"mqDZzEr6tFypg9eMuqBjmcgJTzDARBFp5g\",\n \"mumE7zottnv24kMgZ37Mz5M73g4vpVyaGG\",\n \"mwQLh4tXmAsaowdAjr68UwRmHyT3nCZMaJ\",\n \"msFLpTJ8FoEMNrELSzLahsAFDFmhKhfrSc\",\n \"mz89sDjvPSJC4EUf8ssQm1wm2MfE5XtJYB\",\n \"mrm5Dnn65ByyVkVUntm13xQMAopZNPR6Us\",\n \"mxrv4B1aGmVMitNA2heEDr62sAGdyYA8ZZ\",\n \"mmXPQxvNkdYT8nsgiRAJyH9VitDRVMQk89\",\n \"msea7s76C8FvDW9wQwc2bowo54oZRncMvq\"\n ]\n}"
|
||||
"curl": "curl -d'{\"method\": \"address_list\", \"params\": {\"account_id\": \"mjnSjhq9hseBqH4SdLShwfWsPWmEvnFmBa\"}}' http://localhost:5279/",
|
||||
"lbrynet": "lbrynet address list --account_id=\"mjnSjhq9hseBqH4SdLShwfWsPWmEvnFmBa\"",
|
||||
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"address_list\", \"params\": {\"account_id\": \"mjnSjhq9hseBqH4SdLShwfWsPWmEvnFmBa\"}}).json()",
|
||||
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": [\n \"muzvTMwu85wycsEBTiR74My8AjeanjaarL\",\n \"mpipGa36pkDXB1u1XyHCTBFt3PjG8i9cc4\",\n \"ms2CnsNwPX42NZjkYt3kTF4JfpuSxhmjHj\",\n \"msKBwFDKRQGiCfXo8QmdDtfen9FcFYfgaQ\",\n \"mnCnaxRCfSnr8psqX8WeUHXTSrz9VGAcEo\",\n \"mi37PHLrkAoicex47AwsED7qcx15JwVdo7\",\n \"moBknJhYKrmBcGKeTEuL9UQunQfTkAiJ7m\",\n \"n4aN7LF4s3fbCLfncEpLD3BD1Wwqif5uiD\",\n \"mwPoyC91JPq2QmPpiXYjpUDtZDvHP4sbQn\",\n \"mrddwEaQnkvGDggNMskbYUa6menFeKUNoH\",\n \"mygJGMGKC6pydYNG7sLn5bT4PPPXMb8S54\",\n \"miyQCof94kG5bNSK3BSTr4tAkzjVRxhHTM\",\n \"msZvPxSu6kdPwzCdfcbjkDiK4TJuU8Bx4E\",\n \"mmUpT3VvpofQht94ZQJxU8RzgtWAKWVR3z\",\n \"mhqkehtFa9fCsP9u9XF19asaxuj6HCoCFE\",\n \"mi5YkQEetvta42JnM2qS8XtA5Hd5UuxptL\",\n \"mhxK9RYeGNYFFAbrdFzFSR5LLDzS2BsuTn\",\n \"mrBF61TpHevBNkXbUwWcizu37oahG65x2M\",\n \"mqJtXGmoKmrQPKht1qDTXpGRzsisiFzTBD\",\n \"mvjuDoeqvNGyVXUZ5y59tgCz8iCTjsMKkR\",\n \"mvXjURiW7rHjwiBjYBDfEjVHgsRs3U4eua\",\n \"mxq7FS1tMaf8FGV7rH1VssYTQPvjzEYdBu\",\n \"mt5mn8J9eQxnBeDkUEbMpkxLPo1FiRyphT\",\n \"mqhaqAvFqnFdi9JGmfhpyfH43kyJy1q7yp\",\n \"n29guvsCrb6qT4A94kmdogVmcRtn27L9Lh\",\n \"mxiv1v7tdpVE65QHdmVF6KHLtcm1jHx3N9\"\n ]\n}"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -792,7 +792,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\": \"mnQSixa4Pxn1udNR8HyBCdjC5TeBaq8TWN\"\n}"
|
||||
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": \"mh1BHTvud83u2YRfdb3PwYS29aVS36cZL7\"\n}"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -842,10 +842,10 @@
|
||||
"examples": [
|
||||
{
|
||||
"title": "Delete a blob",
|
||||
"curl": "curl -d'{\"method\": \"blob_delete\", \"params\": {\"blob_hash\": \"fdf95e94ef232c7c2e054d5e306cbedccea2b37fc35c618c3f6ea7d6cc23009acd837b30cd13796d3ef269085fea32f4\"}}' http://localhost:5279/",
|
||||
"lbrynet": "lbrynet blob delete fdf95e94ef232c7c2e054d5e306cbedccea2b37fc35c618c3f6ea7d6cc23009acd837b30cd13796d3ef269085fea32f4",
|
||||
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"blob_delete\", \"params\": {\"blob_hash\": \"fdf95e94ef232c7c2e054d5e306cbedccea2b37fc35c618c3f6ea7d6cc23009acd837b30cd13796d3ef269085fea32f4\"}}).json()",
|
||||
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": \"Deleted fdf95e94ef232c7c2e054d5e306cbedccea2b37fc35c618c3f6ea7d6cc23009acd837b30cd13796d3ef269085fea32f4\"\n}"
|
||||
"curl": "curl -d'{\"method\": \"blob_delete\", \"params\": {\"blob_hash\": \"019de60de1c0e860ae907dfbf13cd4a618a1acb9fb107e09bcaee3a6a7b2165a2a91e740a0fc9d4a4e613a6ed496bc33\"}}' http://localhost:5279/",
|
||||
"lbrynet": "lbrynet blob delete 019de60de1c0e860ae907dfbf13cd4a618a1acb9fb107e09bcaee3a6a7b2165a2a91e740a0fc9d4a4e613a6ed496bc33",
|
||||
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"blob_delete\", \"params\": {\"blob_hash\": \"019de60de1c0e860ae907dfbf13cd4a618a1acb9fb107e09bcaee3a6a7b2165a2a91e740a0fc9d4a4e613a6ed496bc33\"}}).json()",
|
||||
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": \"Deleted 019de60de1c0e860ae907dfbf13cd4a618a1acb9fb107e09bcaee3a6a7b2165a2a91e740a0fc9d4a4e613a6ed496bc33\"\n}"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -923,7 +923,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 \"fdf95e94ef232c7c2e054d5e306cbedccea2b37fc35c618c3f6ea7d6cc23009acd837b30cd13796d3ef269085fea32f4\",\n \"eda7090b2d59beb0d77de489961cb73bbc73bbbb80d2c3c0e5f547b8c07dc0eded9627ce12872ca86a20a51d54ae3c4b\",\n \"ca7f2e83a2d275e25151463521e893b8812aa0b061ab299fb9877521c0a2ced15927eeca4f50680d8ea5e03ae6b6c3f2\",\n \"ab5849f4cd7430dcb6dc98ca0146106501878353b1441cd609b568291e7428aa091610fc247e3aee04cd81951f80d19a\"\n ]\n}"
|
||||
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": [\n \"019de60de1c0e860ae907dfbf13cd4a618a1acb9fb107e09bcaee3a6a7b2165a2a91e740a0fc9d4a4e613a6ed496bc33\",\n \"a0993d23d26f15bd494699edd3a6a37155d9621fe797579a6c12d56147ec17011d869bfbfede8441ee792eadf342a16f\",\n \"2ab7bbd96cb5db43df9ff909c0555dd8a132866355768c41d24f2b4be7c0478ae5f82d2c853e95c9b1179c6743e4bb37\",\n \"e15a45f0d4bf7a6e6c1a39202c974d091e4f44530177b27c6cbec7e949db7afa3ec8d713c87621df4fa7dcc896e0e3ab\"\n ]\n}"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -998,10 +998,10 @@
|
||||
"examples": [
|
||||
{
|
||||
"title": "Abandon a channel claim",
|
||||
"curl": "curl -d'{\"method\": \"channel_abandon\", \"params\": {\"claim_id\": \"cbf954c2782b7cf571f7aa1de960202057618727\", \"preview\": false, \"blocking\": false}}' http://localhost:5279/",
|
||||
"lbrynet": "lbrynet channel abandon cbf954c2782b7cf571f7aa1de960202057618727",
|
||||
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"channel_abandon\", \"params\": {\"claim_id\": \"cbf954c2782b7cf571f7aa1de960202057618727\", \"preview\": false, \"blocking\": false}}).json()",
|
||||
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"01000000019613e2232b6676e29e340a54cd53fa9a9dbec95a4ec106fcd545c67a4ec94f79000000006a47304402206ae5b5c2d22eaf29019546873b6da38d7fbaaa85d2093a7f322e635d807796f702205a08ed6e24fdfb00201f591d9fe634b0dd493b464c9b16467ad86e7ea96013c80121033e683269da2ff2bc9c6a05616cf1eb06f3bb9b5e4a32c6f1498518f19a7a1292ffffffff0134b7f505000000001976a91445692384c08e385350a46f067f3a5433463d67c888ac00000000\",\n \"inputs\": [\n {\n \"address\": \"mvE3pR2rH5mP1Hx8UEipnPt3Atp89tXqVw\",\n \"amount\": \"1.0\",\n \"claim_id\": \"cbf954c2782b7cf571f7aa1de960202057618727\",\n \"claim_op\": \"update\",\n \"confirmations\": 8,\n \"height\": 210,\n \"is_change\": false,\n \"is_mine\": true,\n \"meta\": {},\n \"name\": \"@channel\",\n \"normalized_name\": \"@channel\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://@channel#cbf954c2782b7cf571f7aa1de960202057618727\",\n \"timestamp\": 1565587607,\n \"txid\": \"794fc94e7ac645d5fc06c14e5ac9be9d9afa53cd540a349ee276662b23e21396\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a0342000404b644588c6a32f425fa8c2c3b0404898c79d405d1e90783adcf9a2bdbad505012f1e6be38f7837b69d5f2a1a1959135701780f01fc91c396158c4b1b9b1e304\",\n \"public_key_id\": \"mrPWGtFam2wwv7D1QRgXXrXePLqUGdKaCb\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"mmqxsTY8u2AoV1hQANgfq7dZQ4MY11eWD8\",\n \"amount\": \"0.999893\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 0,\n \"timestamp\": null,\n \"txid\": \"5ada8d9e054ad68005ea1c30d86ba73585a97b6072c46ed73b7f7732866199e1\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.000107\",\n \"total_input\": \"1.0\",\n \"total_output\": \"0.999893\",\n \"txid\": \"5ada8d9e054ad68005ea1c30d86ba73585a97b6072c46ed73b7f7732866199e1\"\n }\n}"
|
||||
"curl": "curl -d'{\"method\": \"channel_abandon\", \"params\": {\"claim_id\": \"1812d3275894f62a055d59189a75698a071108af\", \"preview\": false, \"blocking\": false}}' http://localhost:5279/",
|
||||
"lbrynet": "lbrynet channel abandon 1812d3275894f62a055d59189a75698a071108af",
|
||||
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"channel_abandon\", \"params\": {\"claim_id\": \"1812d3275894f62a055d59189a75698a071108af\", \"preview\": false, \"blocking\": false}}).json()",
|
||||
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"0100000001e76b671b4e9cda4db0eb9558919ebb76aedd164240b34700fe20535a14bf6d98000000006a47304402206086e67b5b3ef2da252bccf728bb3902613130dfee2e69b9cd42e1d51c23462b0220156d8ece8cf7c5b4469584cf6985acbb1fb285b26d4f1f2e69302d7d9a00ca550121026b08677484e71843c5db3ce862355276261d123eaaa5437857daeafeea526930ffffffff0134b7f505000000001976a91489741016527d8e511474fe346d3a54603a173d6588ac00000000\",\n \"inputs\": [\n {\n \"address\": \"mw6SpJDWJeYTWsr2iEFNEbRuqmNhDjpsZS\",\n \"amount\": \"1.0\",\n \"claim_id\": \"1812d3275894f62a055d59189a75698a071108af\",\n \"claim_op\": \"update\",\n \"confirmations\": 8,\n \"height\": 210,\n \"is_change\": false,\n \"is_mine\": true,\n \"meta\": {},\n \"name\": \"@channel\",\n \"normalized_name\": \"@channel\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://@channel#1812d3275894f62a055d59189a75698a071108af\",\n \"timestamp\": 1567524491,\n \"txid\": \"986dbf145a5320fe0047b3404216ddae76bb9e915895ebb04dda9c4e1b676be7\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a034200044974cd9d7098183f8bc9005f3957a4dbfc1ede19044311337fe9f645f256a7a4013c6a142497590bd8461fc50ce6b489453686422079c334bd5f8316b335365e\",\n \"public_key_id\": \"mrne5J4YN1SYYE3qNAAwzEVHAxnZX4AKHp\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"mt3juXFNHFPnCydLvtBwmTyAiXzs5joEcn\",\n \"amount\": \"0.999893\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 0,\n \"timestamp\": null,\n \"txid\": \"f0fbc91e74a19e2826aba44d919fd571ded9e8a8918a75e516795e1eb7ab0e88\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.000107\",\n \"total_input\": \"1.0\",\n \"total_output\": \"0.999893\",\n \"txid\": \"f0fbc91e74a19e2826aba44d919fd571ded9e8a8918a75e516795e1eb7ab0e88\"\n }\n}"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -1125,14 +1125,14 @@
|
||||
"curl": "curl -d'{\"method\": \"channel_create\", \"params\": {\"name\": \"@channel\", \"bid\": \"1.0\", \"featured\": [], \"tags\": [], \"languages\": [], \"locations\": [], \"funding_account_ids\": [], \"preview\": false, \"blocking\": false}}' http://localhost:5279/",
|
||||
"lbrynet": "lbrynet channel create @channel 1.0",
|
||||
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"channel_create\", \"params\": {\"name\": \"@channel\", \"bid\": \"1.0\", \"featured\": [], \"tags\": [], \"languages\": [], \"locations\": [], \"funding_account_ids\": [], \"preview\": false, \"blocking\": false}}).json()",
|
||||
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"010000000104c5f5417877270c58790fa0c3bced42a0d8eaab4d21402087b1860606fc9502010000006a47304402204ced7e0755751c731dce1297d051f95b013871b0b413154932c866cd8b9fc76d0220797632aa02eddb30a8f990879e2380e3389cd27b0d486231af2f2a48c8ceb7060121020ed040533fd5b0e1d1d95abb0f471d7b3592ca27f6bd62630ce0c592d39df90affffffff0200e1f5050000000084b508406368616e6e656c4c5d00125a0a583056301006072a8648ce3d020106052b8104000a0342000404b644588c6a32f425fa8c2c3b0404898c79d405d1e90783adcf9a2bdbad505012f1e6be38f7837b69d5f2a1a1959135701780f01fc91c396158c4b1b9b1e3046d7576a914a1576d19273d6a725bba8c75d4741f5200ed77ba88acc462a029000000001976a914c72eeaa3cb165e05e17357f1162f072ddbf0312788ac00000000\",\n \"inputs\": [\n {\n \"address\": \"mzZF7vd3tBgh9u5tZcX2K4e4DipLzxt6d2\",\n \"amount\": \"7.999876\",\n \"confirmations\": 2,\n \"height\": 207,\n \"is_change\": true,\n \"is_mine\": true,\n \"nout\": 1,\n \"timestamp\": 1565587607,\n \"txid\": \"0295fc060686b1872040214dabead8a042edbcc3a00f79580c27777841f5c504\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"mvE3pR2rH5mP1Hx8UEipnPt3Atp89tXqVw\",\n \"amount\": \"1.0\",\n \"claim_id\": \"cbf954c2782b7cf571f7aa1de960202057618727\",\n \"claim_op\": \"create\",\n \"confirmations\": -2,\n \"height\": -2,\n \"meta\": {},\n \"name\": \"@channel\",\n \"normalized_name\": \"@channel\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://@channel#cbf954c2782b7cf571f7aa1de960202057618727\",\n \"timestamp\": null,\n \"txid\": \"81ea2238e59fcbe25d15d8a7a5ed1853b2461a047d268448cefbeb586c35352f\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a0342000404b644588c6a32f425fa8c2c3b0404898c79d405d1e90783adcf9a2bdbad505012f1e6be38f7837b69d5f2a1a1959135701780f01fc91c396158c4b1b9b1e304\",\n \"public_key_id\": \"mrPWGtFam2wwv7D1QRgXXrXePLqUGdKaCb\"\n },\n \"value_type\": \"channel\"\n },\n {\n \"address\": \"myg8y3kBaKVSyuUWSmgXN56iY5iyMBXza9\",\n \"amount\": \"6.983769\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 1,\n \"timestamp\": null,\n \"txid\": \"81ea2238e59fcbe25d15d8a7a5ed1853b2461a047d268448cefbeb586c35352f\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.016107\",\n \"total_input\": \"7.999876\",\n \"total_output\": \"7.983769\",\n \"txid\": \"81ea2238e59fcbe25d15d8a7a5ed1853b2461a047d268448cefbeb586c35352f\"\n }\n}"
|
||||
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"0100000001ab23f9f5b03ff853815af51428028ea086c65f39e607014eb7c82c0cda0e773e010000006b483045022100fa5029892bd48ce525d38063aa87919c060111d3e8387c8b58df9d8bd15c22de02200a97855e781be63f761008887b2a4a3ff60876bf57fea6590690740fa33458ad01210245c35d292e1b029f82f9cab1749e20a4929e955995bafc33afeae20e4fe78887ffffffff0200e1f5050000000084b508406368616e6e656c4c5d00125a0a583056301006072a8648ce3d020106052b8104000a034200044974cd9d7098183f8bc9005f3957a4dbfc1ede19044311337fe9f645f256a7a4013c6a142497590bd8461fc50ce6b489453686422079c334bd5f8316b335365e6d7576a914aadf6c07f1c7cd225b42ff6abda631b0b102db2888acc462a029000000001976a9149fc8120908ab1812bd462144598da9bc3ffa9d7e88ac00000000\",\n \"inputs\": [\n {\n \"address\": \"muhcUu1j1b5TrfvnsrMJ68CAUA9hahXHZH\",\n \"amount\": \"7.999876\",\n \"confirmations\": 2,\n \"height\": 207,\n \"is_change\": true,\n \"is_mine\": true,\n \"nout\": 1,\n \"timestamp\": 1567524491,\n \"txid\": \"3e770eda0c2cc8b74e0107e6395fc686a08e022814f55a8153f83fb0f5f923ab\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"mw6SpJDWJeYTWsr2iEFNEbRuqmNhDjpsZS\",\n \"amount\": \"1.0\",\n \"claim_id\": \"1812d3275894f62a055d59189a75698a071108af\",\n \"claim_op\": \"create\",\n \"confirmations\": -2,\n \"height\": -2,\n \"meta\": {},\n \"name\": \"@channel\",\n \"normalized_name\": \"@channel\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://@channel#1812d3275894f62a055d59189a75698a071108af\",\n \"timestamp\": null,\n \"txid\": \"71075987fae1171cb3e6b0db1dc1ef7635c9ebd6e26e1d510fdce1e4ebb576fa\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a034200044974cd9d7098183f8bc9005f3957a4dbfc1ede19044311337fe9f645f256a7a4013c6a142497590bd8461fc50ce6b489453686422079c334bd5f8316b335365e\",\n \"public_key_id\": \"mrne5J4YN1SYYE3qNAAwzEVHAxnZX4AKHp\"\n },\n \"value_type\": \"channel\"\n },\n {\n \"address\": \"mv5oQhBhKEBinD1Bs3MKmzznidZSGBN1FG\",\n \"amount\": \"6.983769\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 1,\n \"timestamp\": null,\n \"txid\": \"71075987fae1171cb3e6b0db1dc1ef7635c9ebd6e26e1d510fdce1e4ebb576fa\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.016107\",\n \"total_input\": \"7.999876\",\n \"total_output\": \"7.983769\",\n \"txid\": \"71075987fae1171cb3e6b0db1dc1ef7635c9ebd6e26e1d510fdce1e4ebb576fa\"\n }\n}"
|
||||
},
|
||||
{
|
||||
"title": "Create a channel claim with all metadata",
|
||||
"curl": "curl -d'{\"method\": \"channel_create\", \"params\": {\"name\": \"@bigchannel\", \"bid\": \"1.0\", \"title\": \"Big Channel\", \"description\": \"A channel with lots of videos.\", \"email\": \"creator@smallmedia.com\", \"website_url\": \"http://smallmedia.com\", \"featured\": [], \"tags\": [\"music\", \"art\"], \"languages\": [\"pt-BR\", \"uk\"], \"locations\": [\"BR\", \"UA::Kiyv\"], \"thumbnail_url\": \"http://smallmedia.com/logo.jpg\", \"cover_url\": \"http://smallmedia.com/logo.jpg\", \"funding_account_ids\": [], \"preview\": false, \"blocking\": false}}' http://localhost:5279/",
|
||||
"lbrynet": "lbrynet channel create @bigchannel 1.0 --title=\"Big Channel\" --description=\"A channel with lots of videos.\" --email=\"creator@smallmedia.com\" --tags=music --tags=art --languages=pt-BR --languages=uk --locations=BR --locations=UA::Kiyv --website_url=\"http://smallmedia.com\" --thumbnail_url=\"http://smallmedia.com/logo.jpg\" --cover_url=\"http://smallmedia.com/logo.jpg\"",
|
||||
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"channel_create\", \"params\": {\"name\": \"@bigchannel\", \"bid\": \"1.0\", \"title\": \"Big Channel\", \"description\": \"A channel with lots of videos.\", \"email\": \"creator@smallmedia.com\", \"website_url\": \"http://smallmedia.com\", \"featured\": [], \"tags\": [\"music\", \"art\"], \"languages\": [\"pt-BR\", \"uk\"], \"locations\": [\"BR\", \"UA::Kiyv\"], \"thumbnail_url\": \"http://smallmedia.com/logo.jpg\", \"cover_url\": \"http://smallmedia.com/logo.jpg\", \"funding_account_ids\": [], \"preview\": false, \"blocking\": false}}).json()",
|
||||
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"01000000019613e2232b6676e29e340a54cd53fa9a9dbec95a4ec106fcd545c67a4ec94f79010000006a473044022022a7418c87d93c0ec797848349b95acaa3e50ae740706940934aeab3076564300220297a6c913f43b6c1405b097ce2e98ace59eec82470e63d6cd5a0e59a05076069012103685aa1350bd3454aaa469ad31e54c9d1aa5461fda343a96aca78e773f7a08b19ffffffff0200e1f50500000000fd5001b50b406269676368616e6e656c4d25010012ab010a583056301006072a8648ce3d020106052b8104000a03420004302494206e748d6062dc11249aae7ad32a19928a85720723f6d7938c413daccab152f5577a9506066237a0453531645c4d2be7bdf950cba650e4be5bc61dfa04121663726561746f7240736d616c6c6d656469612e636f6d1a15687474703a2f2f736d616c6c6d656469612e636f6d22202a1e687474703a2f2f736d616c6c6d656469612e636f6d2f6c6f676f2e6a7067420b426967204368616e6e656c4a1e41206368616e6e656c2077697468206c6f7473206f6620766964656f732e52202a1e687474703a2f2f736d616c6c6d656469612e636f6d2f6c6f676f2e6a70675a056d757369635a0361727462050883011820620308ab016a0208206a0908e9011a044b6979766d7576a9144b8db34e9113f54c681086797b664b4ed33649e788ace221d305000000001976a914cdd2a5b42610fc0182b882c47aca759dd59e7ece88ac00000000\",\n \"inputs\": [\n {\n \"address\": \"n19NX4hFThAvep5r78VhPh4rL9syV9WDrP\",\n \"amount\": \"1.9993355\",\n \"confirmations\": 1,\n \"height\": 210,\n \"is_change\": true,\n \"is_mine\": true,\n \"nout\": 1,\n \"timestamp\": 1565587607,\n \"txid\": \"794fc94e7ac645d5fc06c14e5ac9be9d9afa53cd540a349ee276662b23e21396\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"mnQSixa4Pxn1udNR8HyBCdjC5TeBaq8TWN\",\n \"amount\": \"1.0\",\n \"claim_id\": \"66dbad60875d8995f9429057d71a5171d7850dec\",\n \"claim_op\": \"create\",\n \"confirmations\": -2,\n \"height\": -2,\n \"meta\": {},\n \"name\": \"@bigchannel\",\n \"normalized_name\": \"@bigchannel\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://@bigchannel#66dbad60875d8995f9429057d71a5171d7850dec\",\n \"timestamp\": null,\n \"txid\": \"1a11ffa76a74be172696239f26ef267fca420b199c0bf8a9831152b83f86f8e3\",\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\": \"3056301006072a8648ce3d020106052b8104000a03420004302494206e748d6062dc11249aae7ad32a19928a85720723f6d7938c413daccab152f5577a9506066237a0453531645c4d2be7bdf950cba650e4be5bc61dfa04\",\n \"public_key_id\": \"mwx9vaUSKMxVkGCYWdZmxx6P6PF4zPNFMq\",\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\": \"mzHFAQfgBr1QpQr8YSMpJFg54vkhwU2WoB\",\n \"amount\": \"0.9772285\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 1,\n \"timestamp\": null,\n \"txid\": \"1a11ffa76a74be172696239f26ef267fca420b199c0bf8a9831152b83f86f8e3\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.022107\",\n \"total_input\": \"1.9993355\",\n \"total_output\": \"1.9772285\",\n \"txid\": \"1a11ffa76a74be172696239f26ef267fca420b199c0bf8a9831152b83f86f8e3\"\n }\n}"
|
||||
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"0100000001e76b671b4e9cda4db0eb9558919ebb76aedd164240b34700fe20535a14bf6d98010000006b483045022100f682c30b7e11d75a7c8003a0cf960225084bc0848dd1b87b9bcb5943df7cc89a02206eeb81a9d82041bc002938de734054e5bfbc0449ea595d047d830022815fcceb012102f468240028c0200dd91d0471061d20b84380888f5bc5e025512c710867053b4dffffffff0200e1f50500000000fd5001b50b406269676368616e6e656c4d25010012ab010a583056301006072a8648ce3d020106052b8104000a03420004af3f67b2c8c268546ddc740380fcea6dd60eadec5cb2fd081ec1d59bad5c8f94556d94f5b96f116459fe476de5597fbc9641f37751743d17fe33b213513bc658121663726561746f7240736d616c6c6d656469612e636f6d1a15687474703a2f2f736d616c6c6d656469612e636f6d22202a1e687474703a2f2f736d616c6c6d656469612e636f6d2f6c6f676f2e6a7067420b426967204368616e6e656c4a1e41206368616e6e656c2077697468206c6f7473206f6620766964656f732e52202a1e687474703a2f2f736d616c6c6d656469612e636f6d2f6c6f676f2e6a70675a056d757369635a0361727462050883011820620308ab016a0208206a0908e9011a044b6979766d7576a91462e43cc42aaf50122b0b822c72e92df47752382488ace221d305000000001976a914c2d853ebfe9374f515d77fcc99fa3a4720dcd9d288ac00000000\",\n \"inputs\": [\n {\n \"address\": \"mvHTTahf6ZHHUJyEMpAXCDRQrvtSq2jAxZ\",\n \"amount\": \"1.9993355\",\n \"confirmations\": 1,\n \"height\": 210,\n \"is_change\": true,\n \"is_mine\": true,\n \"nout\": 1,\n \"timestamp\": 1567524491,\n \"txid\": \"986dbf145a5320fe0047b3404216ddae76bb9e915895ebb04dda9c4e1b676be7\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"mpXqw4ekUeJnVt4HUVaUosdMRHckFLpJCV\",\n \"amount\": \"1.0\",\n \"claim_id\": \"70be52d169e5debb0021317540fc7bc941af02dc\",\n \"claim_op\": \"create\",\n \"confirmations\": -2,\n \"height\": -2,\n \"meta\": {},\n \"name\": \"@bigchannel\",\n \"normalized_name\": \"@bigchannel\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://@bigchannel#70be52d169e5debb0021317540fc7bc941af02dc\",\n \"timestamp\": null,\n \"txid\": \"9b92799eb906956b01458dd97ace5e02f3c201a1c67089dc694b11caa77fedbd\",\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\": \"3056301006072a8648ce3d020106052b8104000a03420004af3f67b2c8c268546ddc740380fcea6dd60eadec5cb2fd081ec1d59bad5c8f94556d94f5b96f116459fe476de5597fbc9641f37751743d17fe33b213513bc658\",\n \"public_key_id\": \"n34uW64WnxJnnr9n6PWsHrzpQf2Qg8jV1h\",\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\": \"myHCXzM5bmTxED6Tyc9WcLhGsP1u8M9Wfo\",\n \"amount\": \"0.9772285\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 1,\n \"timestamp\": null,\n \"txid\": \"9b92799eb906956b01458dd97ace5e02f3c201a1c67089dc694b11caa77fedbd\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.022107\",\n \"total_input\": \"1.9993355\",\n \"total_output\": \"1.9772285\",\n \"txid\": \"9b92799eb906956b01458dd97ace5e02f3c201a1c67089dc694b11caa77fedbd\"\n }\n}"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -1206,14 +1206,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\": \"mvE3pR2rH5mP1Hx8UEipnPt3Atp89tXqVw\",\n \"amount\": \"1.0\",\n \"claim_id\": \"cbf954c2782b7cf571f7aa1de960202057618727\",\n \"claim_op\": \"create\",\n \"confirmations\": 1,\n \"height\": 209,\n \"is_change\": false,\n \"is_mine\": true,\n \"meta\": {},\n \"name\": \"@channel\",\n \"normalized_name\": \"@channel\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://@channel#cbf954c2782b7cf571f7aa1de960202057618727\",\n \"timestamp\": 1565587607,\n \"txid\": \"81ea2238e59fcbe25d15d8a7a5ed1853b2461a047d268448cefbeb586c35352f\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a0342000404b644588c6a32f425fa8c2c3b0404898c79d405d1e90783adcf9a2bdbad505012f1e6be38f7837b69d5f2a1a1959135701780f01fc91c396158c4b1b9b1e304\",\n \"public_key_id\": \"mrPWGtFam2wwv7D1QRgXXrXePLqUGdKaCb\"\n },\n \"value_type\": \"channel\"\n }\n ]\n}"
|
||||
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": [\n {\n \"address\": \"mw6SpJDWJeYTWsr2iEFNEbRuqmNhDjpsZS\",\n \"amount\": \"1.0\",\n \"claim_id\": \"1812d3275894f62a055d59189a75698a071108af\",\n \"claim_op\": \"create\",\n \"confirmations\": 1,\n \"height\": 209,\n \"is_change\": false,\n \"is_mine\": true,\n \"meta\": {},\n \"name\": \"@channel\",\n \"normalized_name\": \"@channel\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://@channel#1812d3275894f62a055d59189a75698a071108af\",\n \"timestamp\": 1567524491,\n \"txid\": \"71075987fae1171cb3e6b0db1dc1ef7635c9ebd6e26e1d510fdce1e4ebb576fa\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a034200044974cd9d7098183f8bc9005f3957a4dbfc1ede19044311337fe9f645f256a7a4013c6a142497590bd8461fc50ce6b489453686422079c334bd5f8316b335365e\",\n \"public_key_id\": \"mrne5J4YN1SYYE3qNAAwzEVHAxnZX4AKHp\"\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\": \"mvE3pR2rH5mP1Hx8UEipnPt3Atp89tXqVw\",\n \"amount\": \"1.0\",\n \"claim_id\": \"cbf954c2782b7cf571f7aa1de960202057618727\",\n \"claim_op\": \"create\",\n \"confirmations\": 1,\n \"height\": 209,\n \"is_change\": false,\n \"is_mine\": true,\n \"meta\": {},\n \"name\": \"@channel\",\n \"normalized_name\": \"@channel\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://@channel#cbf954c2782b7cf571f7aa1de960202057618727\",\n \"timestamp\": 1565587607,\n \"txid\": \"81ea2238e59fcbe25d15d8a7a5ed1853b2461a047d268448cefbeb586c35352f\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a0342000404b644588c6a32f425fa8c2c3b0404898c79d405d1e90783adcf9a2bdbad505012f1e6be38f7837b69d5f2a1a1959135701780f01fc91c396158c4b1b9b1e304\",\n \"public_key_id\": \"mrPWGtFam2wwv7D1QRgXXrXePLqUGdKaCb\"\n },\n \"value_type\": \"channel\"\n }\n ],\n \"page\": 1,\n \"page_size\": 20,\n \"total_items\": 1,\n \"total_pages\": 1\n }\n}"
|
||||
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"items\": [\n {\n \"address\": \"mw6SpJDWJeYTWsr2iEFNEbRuqmNhDjpsZS\",\n \"amount\": \"1.0\",\n \"claim_id\": \"1812d3275894f62a055d59189a75698a071108af\",\n \"claim_op\": \"create\",\n \"confirmations\": 1,\n \"height\": 209,\n \"is_change\": false,\n \"is_mine\": true,\n \"meta\": {},\n \"name\": \"@channel\",\n \"normalized_name\": \"@channel\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://@channel#1812d3275894f62a055d59189a75698a071108af\",\n \"timestamp\": 1567524491,\n \"txid\": \"71075987fae1171cb3e6b0db1dc1ef7635c9ebd6e26e1d510fdce1e4ebb576fa\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a034200044974cd9d7098183f8bc9005f3957a4dbfc1ede19044311337fe9f645f256a7a4013c6a142497590bd8461fc50ce6b489453686422079c334bd5f8316b335365e\",\n \"public_key_id\": \"mrne5J4YN1SYYE3qNAAwzEVHAxnZX4AKHp\"\n },\n \"value_type\": \"channel\"\n }\n ],\n \"page\": 1,\n \"page_size\": 20,\n \"total_items\": 1,\n \"total_pages\": 1\n }\n}"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -1364,10 +1364,10 @@
|
||||
"examples": [
|
||||
{
|
||||
"title": "Update a channel claim",
|
||||
"curl": "curl -d'{\"method\": \"channel_update\", \"params\": {\"claim_id\": \"cbf954c2782b7cf571f7aa1de960202057618727\", \"title\": \"New Channel\", \"featured\": [], \"clear_featured\": false, \"tags\": [], \"clear_tags\": false, \"languages\": [], \"clear_languages\": false, \"locations\": [], \"clear_locations\": false, \"new_signing_key\": false, \"funding_account_ids\": [], \"preview\": false, \"blocking\": false, \"replace\": false}}' http://localhost:5279/",
|
||||
"lbrynet": "lbrynet channel update cbf954c2782b7cf571f7aa1de960202057618727 --title=\"New Channel\"",
|
||||
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"channel_update\", \"params\": {\"claim_id\": \"cbf954c2782b7cf571f7aa1de960202057618727\", \"title\": \"New Channel\", \"featured\": [], \"clear_featured\": false, \"tags\": [], \"clear_tags\": false, \"languages\": [], \"clear_languages\": false, \"locations\": [], \"clear_locations\": false, \"new_signing_key\": false, \"funding_account_ids\": [], \"preview\": false, \"blocking\": false, \"replace\": false}}).json()",
|
||||
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"01000000022f35356c58ebfbce4884267d041a46b25318eda5a7d8155de2cb9fe53822ea81000000006a47304402206fff2ae3c959730b57e5b003eeb90974bb8d1a6f7056ce590d0959be9430d7520220573010e8bd008d0a9a93bb20716a1eb396eba98700a0342bbca4e6fbe6e8d45d0121033e683269da2ff2bc9c6a05616cf1eb06f3bb9b5e4a32c6f1498518f19a7a1292ffffffffcd0929849206138ad19f2efb9f58c30b431846411028509b66476de9e9b63180000000006a473044022077467b92bb4fb1cc0710155978629591f861971b9004659349c258b6f39d50990220404af1a82bd4739d3e24ade370cd6989ba29b28834fc99b575854e1a223b5838012102d615d7b74f294ccd272353330d31fd5509651c164873a61f53b3fc07300aac3effffffff0200e1f50500000000a6b708406368616e6e656c1427876157202060e91daaf771f57c2b78c254f9cb4c6a00125a0a583056301006072a8648ce3d020106052b8104000a0342000404b644588c6a32f425fa8c2c3b0404898c79d405d1e90783adcf9a2bdbad505012f1e6be38f7837b69d5f2a1a1959135701780f01fc91c396158c4b1b9b1e304420b4e6577204368616e6e656c6d6d76a914a1576d19273d6a725bba8c75d4741f5200ed77ba88ac6ebeea0b000000001976a914d74d96016a44ba6ab6d4b8a64dcc51fb59601b7d88ac00000000\",\n \"inputs\": [\n {\n \"address\": \"mvE3pR2rH5mP1Hx8UEipnPt3Atp89tXqVw\",\n \"amount\": \"1.0\",\n \"claim_id\": \"cbf954c2782b7cf571f7aa1de960202057618727\",\n \"claim_op\": \"create\",\n \"confirmations\": 1,\n \"height\": 209,\n \"is_change\": false,\n \"is_mine\": true,\n \"meta\": {},\n \"name\": \"@channel\",\n \"normalized_name\": \"@channel\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://@channel#cbf954c2782b7cf571f7aa1de960202057618727\",\n \"timestamp\": 1565587607,\n \"txid\": \"81ea2238e59fcbe25d15d8a7a5ed1853b2461a047d268448cefbeb586c35352f\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a0342000404b644588c6a32f425fa8c2c3b0404898c79d405d1e90783adcf9a2bdbad505012f1e6be38f7837b69d5f2a1a1959135701780f01fc91c396158c4b1b9b1e304\",\n \"public_key_id\": \"mrPWGtFam2wwv7D1QRgXXrXePLqUGdKaCb\"\n },\n \"value_type\": \"channel\"\n },\n {\n \"address\": \"mqufgoJUGVmpBPShNwTYNrAa34mYcS2BAZ\",\n \"amount\": \"1.999604\",\n \"confirmations\": 1,\n \"height\": 209,\n \"is_change\": true,\n \"is_mine\": true,\n \"nout\": 0,\n \"timestamp\": 1565587607,\n \"txid\": \"8031b6e9e96d47669b502810414618430bc3589ffb2e9fd18a130692842909cd\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"mvE3pR2rH5mP1Hx8UEipnPt3Atp89tXqVw\",\n \"amount\": \"1.0\",\n \"claim_id\": \"cbf954c2782b7cf571f7aa1de960202057618727\",\n \"claim_op\": \"update\",\n \"confirmations\": -2,\n \"height\": -2,\n \"meta\": {},\n \"name\": \"@channel\",\n \"normalized_name\": \"@channel\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://@channel#cbf954c2782b7cf571f7aa1de960202057618727\",\n \"timestamp\": null,\n \"txid\": \"794fc94e7ac645d5fc06c14e5ac9be9d9afa53cd540a349ee276662b23e21396\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a0342000404b644588c6a32f425fa8c2c3b0404898c79d405d1e90783adcf9a2bdbad505012f1e6be38f7837b69d5f2a1a1959135701780f01fc91c396158c4b1b9b1e304\",\n \"public_key_id\": \"mrPWGtFam2wwv7D1QRgXXrXePLqUGdKaCb\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n },\n {\n \"address\": \"n19NX4hFThAvep5r78VhPh4rL9syV9WDrP\",\n \"amount\": \"1.9993355\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 1,\n \"timestamp\": null,\n \"txid\": \"794fc94e7ac645d5fc06c14e5ac9be9d9afa53cd540a349ee276662b23e21396\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.0002685\",\n \"total_input\": \"2.999604\",\n \"total_output\": \"2.9993355\",\n \"txid\": \"794fc94e7ac645d5fc06c14e5ac9be9d9afa53cd540a349ee276662b23e21396\"\n }\n}"
|
||||
"curl": "curl -d'{\"method\": \"channel_update\", \"params\": {\"claim_id\": \"1812d3275894f62a055d59189a75698a071108af\", \"title\": \"New Channel\", \"featured\": [], \"clear_featured\": false, \"tags\": [], \"clear_tags\": false, \"languages\": [], \"clear_languages\": false, \"locations\": [], \"clear_locations\": false, \"new_signing_key\": false, \"funding_account_ids\": [], \"preview\": false, \"blocking\": false, \"replace\": false}}' http://localhost:5279/",
|
||||
"lbrynet": "lbrynet channel update 1812d3275894f62a055d59189a75698a071108af --title=\"New Channel\"",
|
||||
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"channel_update\", \"params\": {\"claim_id\": \"1812d3275894f62a055d59189a75698a071108af\", \"title\": \"New Channel\", \"featured\": [], \"clear_featured\": false, \"tags\": [], \"clear_tags\": false, \"languages\": [], \"clear_languages\": false, \"locations\": [], \"clear_locations\": false, \"new_signing_key\": false, \"funding_account_ids\": [], \"preview\": false, \"blocking\": false, \"replace\": false}}).json()",
|
||||
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"0100000002fa76b5ebe4e1dc0f511d6ee2d6ebc93576efc11ddbb0e6b31c17e1fa87590771000000006b483045022100c66ff055a275b9217ef363ae87ffda7ef44986bef685cec8d2ccafbbc367160e02206c191c13d228d516854537915a2101dee9065ed364c17437fc6a9aa8fb1421e70121026b08677484e71843c5db3ce862355276261d123eaaa5437857daeafeea526930ffffffff2c446233fb6c0e348fce0d78c98eb0ba6fa84a5f949e46424aa38cfc1d29f844000000006a47304402206956d6778c51de7306fb9e924ff8f58e2401517290ed64cb2e6c46b8a7bb69f902205c1375c4c0a8411db6a415a4950ec433410c01985c1ca7cbfb0de7145368aa50012102dface3eea48cf6ad620818099a453434adbf56c152268e680f23666d55ce2ac3ffffffff0200e1f50500000000a6b708406368616e6e656c14af0811078a69759a18595d052af6945827d312184c6a00125a0a583056301006072a8648ce3d020106052b8104000a034200044974cd9d7098183f8bc9005f3957a4dbfc1ede19044311337fe9f645f256a7a4013c6a142497590bd8461fc50ce6b489453686422079c334bd5f8316b335365e420b4e6577204368616e6e656c6d6d76a914aadf6c07f1c7cd225b42ff6abda631b0b102db2888ac6ebeea0b000000001976a914a1fc688cf5f6899e6342e463d72eca70f73b973388ac00000000\",\n \"inputs\": [\n {\n \"address\": \"mw6SpJDWJeYTWsr2iEFNEbRuqmNhDjpsZS\",\n \"amount\": \"1.0\",\n \"claim_id\": \"1812d3275894f62a055d59189a75698a071108af\",\n \"claim_op\": \"create\",\n \"confirmations\": 1,\n \"height\": 209,\n \"is_change\": false,\n \"is_mine\": true,\n \"meta\": {},\n \"name\": \"@channel\",\n \"normalized_name\": \"@channel\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://@channel#1812d3275894f62a055d59189a75698a071108af\",\n \"timestamp\": 1567524491,\n \"txid\": \"71075987fae1171cb3e6b0db1dc1ef7635c9ebd6e26e1d510fdce1e4ebb576fa\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a034200044974cd9d7098183f8bc9005f3957a4dbfc1ede19044311337fe9f645f256a7a4013c6a142497590bd8461fc50ce6b489453686422079c334bd5f8316b335365e\",\n \"public_key_id\": \"mrne5J4YN1SYYE3qNAAwzEVHAxnZX4AKHp\"\n },\n \"value_type\": \"channel\"\n },\n {\n \"address\": \"mqeKEJuCipt8ArNwvnd9Ed2mpdVSKFjFPf\",\n \"amount\": \"1.999604\",\n \"confirmations\": 1,\n \"height\": 209,\n \"is_change\": true,\n \"is_mine\": true,\n \"nout\": 0,\n \"timestamp\": 1567524491,\n \"txid\": \"44f8291dfc8ca34a42469e945f4aa86fbab08ec9780dce8f340e6cfb3362442c\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"mw6SpJDWJeYTWsr2iEFNEbRuqmNhDjpsZS\",\n \"amount\": \"1.0\",\n \"claim_id\": \"1812d3275894f62a055d59189a75698a071108af\",\n \"claim_op\": \"update\",\n \"confirmations\": -2,\n \"height\": -2,\n \"meta\": {},\n \"name\": \"@channel\",\n \"normalized_name\": \"@channel\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://@channel#1812d3275894f62a055d59189a75698a071108af\",\n \"timestamp\": null,\n \"txid\": \"986dbf145a5320fe0047b3404216ddae76bb9e915895ebb04dda9c4e1b676be7\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a034200044974cd9d7098183f8bc9005f3957a4dbfc1ede19044311337fe9f645f256a7a4013c6a142497590bd8461fc50ce6b489453686422079c334bd5f8316b335365e\",\n \"public_key_id\": \"mrne5J4YN1SYYE3qNAAwzEVHAxnZX4AKHp\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n },\n {\n \"address\": \"mvHTTahf6ZHHUJyEMpAXCDRQrvtSq2jAxZ\",\n \"amount\": \"1.9993355\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 1,\n \"timestamp\": null,\n \"txid\": \"986dbf145a5320fe0047b3404216ddae76bb9e915895ebb04dda9c4e1b676be7\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.0002685\",\n \"total_input\": \"2.999604\",\n \"total_output\": \"2.9993355\",\n \"txid\": \"986dbf145a5320fe0047b3404216ddae76bb9e915895ebb04dda9c4e1b676be7\"\n }\n}"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1406,14 +1406,14 @@
|
||||
"curl": "curl -d'{\"method\": \"claim_list\", \"params\": {}}' http://localhost:5279/",
|
||||
"lbrynet": "lbrynet claim list",
|
||||
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"claim_list\", \"params\": {}}).json()",
|
||||
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": [\n {\n \"address\": \"mhUNYMksuH5HFj2DUG1DsLAtMMaup1cgqn\",\n \"amount\": \"1.0\",\n \"claim_id\": \"68fde0328b1a267b3815ce974a6329b159619092\",\n \"claim_op\": \"update\",\n \"confirmations\": 1,\n \"height\": 214,\n \"is_change\": false,\n \"is_channel_signature_valid\": true,\n \"is_mine\": true,\n \"meta\": {},\n \"name\": \"astream\",\n \"normalized_name\": \"astream\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://astream#68fde0328b1a267b3815ce974a6329b159619092\",\n \"signing_channel\": {\n \"address\": \"mvE3pR2rH5mP1Hx8UEipnPt3Atp89tXqVw\",\n \"amount\": \"1.0\",\n \"claim_id\": \"cbf954c2782b7cf571f7aa1de960202057618727\",\n \"claim_op\": \"update\",\n \"confirmations\": 5,\n \"height\": 210,\n \"is_change\": false,\n \"is_mine\": true,\n \"meta\": {},\n \"name\": \"@channel\",\n \"normalized_name\": \"@channel\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://@channel#cbf954c2782b7cf571f7aa1de960202057618727\",\n \"timestamp\": 1565587607,\n \"txid\": \"794fc94e7ac645d5fc06c14e5ac9be9d9afa53cd540a349ee276662b23e21396\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a0342000404b644588c6a32f425fa8c2c3b0404898c79d405d1e90783adcf9a2bdbad505012f1e6be38f7837b69d5f2a1a1959135701780f01fc91c396158c4b1b9b1e304\",\n \"public_key_id\": \"mrPWGtFam2wwv7D1QRgXXrXePLqUGdKaCb\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n },\n \"timestamp\": 1565587608,\n \"txid\": \"55a247d733323e8645656c1c817ac34411fafb5493f9c528091897b6ca0e5400\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpwc0xotjc\",\n \"sd_hash\": \"ca7f2e83a2d275e25151463521e893b8812aa0b061ab299fb9877521c0a2ced15927eeca4f50680d8ea5e03ae6b6c3f2\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"value_type\": \"stream\"\n },\n {\n \"address\": \"mvE3pR2rH5mP1Hx8UEipnPt3Atp89tXqVw\",\n \"amount\": \"1.0\",\n \"claim_id\": \"cbf954c2782b7cf571f7aa1de960202057618727\",\n \"claim_op\": \"update\",\n \"confirmations\": 5,\n \"height\": 210,\n \"is_change\": false,\n \"is_mine\": true,\n \"meta\": {},\n \"name\": \"@channel\",\n \"normalized_name\": \"@channel\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://@channel#cbf954c2782b7cf571f7aa1de960202057618727\",\n \"timestamp\": 1565587607,\n \"txid\": \"794fc94e7ac645d5fc06c14e5ac9be9d9afa53cd540a349ee276662b23e21396\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a0342000404b644588c6a32f425fa8c2c3b0404898c79d405d1e90783adcf9a2bdbad505012f1e6be38f7837b69d5f2a1a1959135701780f01fc91c396158c4b1b9b1e304\",\n \"public_key_id\": \"mrPWGtFam2wwv7D1QRgXXrXePLqUGdKaCb\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n }\n ]\n}"
|
||||
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": [\n {\n \"address\": \"mqwocM9E8dcY9aHCaCGG6HXB8Pd3hA9KjF\",\n \"amount\": \"1.0\",\n \"claim_id\": \"bfb7d50e084d6d246ca9ff909c401aab30a6f9a6\",\n \"claim_op\": \"update\",\n \"confirmations\": 1,\n \"height\": 214,\n \"is_change\": false,\n \"is_channel_signature_valid\": true,\n \"is_mine\": true,\n \"meta\": {},\n \"name\": \"astream\",\n \"normalized_name\": \"astream\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://astream#bfb7d50e084d6d246ca9ff909c401aab30a6f9a6\",\n \"signing_channel\": {\n \"address\": \"mw6SpJDWJeYTWsr2iEFNEbRuqmNhDjpsZS\",\n \"amount\": \"1.0\",\n \"claim_id\": \"1812d3275894f62a055d59189a75698a071108af\",\n \"claim_op\": \"update\",\n \"confirmations\": 5,\n \"height\": 210,\n \"is_change\": false,\n \"is_mine\": true,\n \"meta\": {},\n \"name\": \"@channel\",\n \"normalized_name\": \"@channel\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://@channel#1812d3275894f62a055d59189a75698a071108af\",\n \"timestamp\": 1567524491,\n \"txid\": \"986dbf145a5320fe0047b3404216ddae76bb9e915895ebb04dda9c4e1b676be7\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a034200044974cd9d7098183f8bc9005f3957a4dbfc1ede19044311337fe9f645f256a7a4013c6a142497590bd8461fc50ce6b489453686422079c334bd5f8316b335365e\",\n \"public_key_id\": \"mrne5J4YN1SYYE3qNAAwzEVHAxnZX4AKHp\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n },\n \"timestamp\": 1567524492,\n \"txid\": \"f3338742c2b4cf0e35b7ffa73aea3e9da786926cf82f07d3100e09d04ec3f231\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpmjego0ff\",\n \"sd_hash\": \"2ab7bbd96cb5db43df9ff909c0555dd8a132866355768c41d24f2b4be7c0478ae5f82d2c853e95c9b1179c6743e4bb37\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"value_type\": \"stream\"\n },\n {\n \"address\": \"mw6SpJDWJeYTWsr2iEFNEbRuqmNhDjpsZS\",\n \"amount\": \"1.0\",\n \"claim_id\": \"1812d3275894f62a055d59189a75698a071108af\",\n \"claim_op\": \"update\",\n \"confirmations\": 5,\n \"height\": 210,\n \"is_change\": false,\n \"is_mine\": true,\n \"meta\": {},\n \"name\": \"@channel\",\n \"normalized_name\": \"@channel\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://@channel#1812d3275894f62a055d59189a75698a071108af\",\n \"timestamp\": 1567524491,\n \"txid\": \"986dbf145a5320fe0047b3404216ddae76bb9e915895ebb04dda9c4e1b676be7\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a034200044974cd9d7098183f8bc9005f3957a4dbfc1ede19044311337fe9f645f256a7a4013c6a142497590bd8461fc50ce6b489453686422079c334bd5f8316b335365e\",\n \"public_key_id\": \"mrne5J4YN1SYYE3qNAAwzEVHAxnZX4AKHp\",\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\": \"mhUNYMksuH5HFj2DUG1DsLAtMMaup1cgqn\",\n \"amount\": \"1.0\",\n \"claim_id\": \"68fde0328b1a267b3815ce974a6329b159619092\",\n \"claim_op\": \"update\",\n \"confirmations\": 1,\n \"height\": 214,\n \"is_change\": false,\n \"is_channel_signature_valid\": true,\n \"is_mine\": true,\n \"meta\": {},\n \"name\": \"astream\",\n \"normalized_name\": \"astream\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://astream#68fde0328b1a267b3815ce974a6329b159619092\",\n \"signing_channel\": {\n \"address\": \"mvE3pR2rH5mP1Hx8UEipnPt3Atp89tXqVw\",\n \"amount\": \"1.0\",\n \"claim_id\": \"cbf954c2782b7cf571f7aa1de960202057618727\",\n \"claim_op\": \"update\",\n \"confirmations\": 5,\n \"height\": 210,\n \"is_change\": false,\n \"is_mine\": true,\n \"meta\": {},\n \"name\": \"@channel\",\n \"normalized_name\": \"@channel\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://@channel#cbf954c2782b7cf571f7aa1de960202057618727\",\n \"timestamp\": 1565587607,\n \"txid\": \"794fc94e7ac645d5fc06c14e5ac9be9d9afa53cd540a349ee276662b23e21396\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a0342000404b644588c6a32f425fa8c2c3b0404898c79d405d1e90783adcf9a2bdbad505012f1e6be38f7837b69d5f2a1a1959135701780f01fc91c396158c4b1b9b1e304\",\n \"public_key_id\": \"mrPWGtFam2wwv7D1QRgXXrXePLqUGdKaCb\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n },\n \"timestamp\": 1565587608,\n \"txid\": \"55a247d733323e8645656c1c817ac34411fafb5493f9c528091897b6ca0e5400\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpwc0xotjc\",\n \"sd_hash\": \"ca7f2e83a2d275e25151463521e893b8812aa0b061ab299fb9877521c0a2ced15927eeca4f50680d8ea5e03ae6b6c3f2\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"value_type\": \"stream\"\n },\n {\n \"address\": \"mvE3pR2rH5mP1Hx8UEipnPt3Atp89tXqVw\",\n \"amount\": \"1.0\",\n \"claim_id\": \"cbf954c2782b7cf571f7aa1de960202057618727\",\n \"claim_op\": \"update\",\n \"confirmations\": 5,\n \"height\": 210,\n \"is_change\": false,\n \"is_mine\": true,\n \"meta\": {},\n \"name\": \"@channel\",\n \"normalized_name\": \"@channel\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://@channel#cbf954c2782b7cf571f7aa1de960202057618727\",\n \"timestamp\": 1565587607,\n \"txid\": \"794fc94e7ac645d5fc06c14e5ac9be9d9afa53cd540a349ee276662b23e21396\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a0342000404b644588c6a32f425fa8c2c3b0404898c79d405d1e90783adcf9a2bdbad505012f1e6be38f7837b69d5f2a1a1959135701780f01fc91c396158c4b1b9b1e304\",\n \"public_key_id\": \"mrPWGtFam2wwv7D1QRgXXrXePLqUGdKaCb\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n }\n ],\n \"page\": 1,\n \"page_size\": 20,\n \"total_items\": 2,\n \"total_pages\": 1\n }\n}"
|
||||
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"items\": [\n {\n \"address\": \"mqwocM9E8dcY9aHCaCGG6HXB8Pd3hA9KjF\",\n \"amount\": \"1.0\",\n \"claim_id\": \"bfb7d50e084d6d246ca9ff909c401aab30a6f9a6\",\n \"claim_op\": \"update\",\n \"confirmations\": 1,\n \"height\": 214,\n \"is_change\": false,\n \"is_channel_signature_valid\": true,\n \"is_mine\": true,\n \"meta\": {},\n \"name\": \"astream\",\n \"normalized_name\": \"astream\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://astream#bfb7d50e084d6d246ca9ff909c401aab30a6f9a6\",\n \"signing_channel\": {\n \"address\": \"mw6SpJDWJeYTWsr2iEFNEbRuqmNhDjpsZS\",\n \"amount\": \"1.0\",\n \"claim_id\": \"1812d3275894f62a055d59189a75698a071108af\",\n \"claim_op\": \"update\",\n \"confirmations\": 5,\n \"height\": 210,\n \"is_change\": false,\n \"is_mine\": true,\n \"meta\": {},\n \"name\": \"@channel\",\n \"normalized_name\": \"@channel\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://@channel#1812d3275894f62a055d59189a75698a071108af\",\n \"timestamp\": 1567524491,\n \"txid\": \"986dbf145a5320fe0047b3404216ddae76bb9e915895ebb04dda9c4e1b676be7\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a034200044974cd9d7098183f8bc9005f3957a4dbfc1ede19044311337fe9f645f256a7a4013c6a142497590bd8461fc50ce6b489453686422079c334bd5f8316b335365e\",\n \"public_key_id\": \"mrne5J4YN1SYYE3qNAAwzEVHAxnZX4AKHp\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n },\n \"timestamp\": 1567524492,\n \"txid\": \"f3338742c2b4cf0e35b7ffa73aea3e9da786926cf82f07d3100e09d04ec3f231\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpmjego0ff\",\n \"sd_hash\": \"2ab7bbd96cb5db43df9ff909c0555dd8a132866355768c41d24f2b4be7c0478ae5f82d2c853e95c9b1179c6743e4bb37\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"value_type\": \"stream\"\n },\n {\n \"address\": \"mw6SpJDWJeYTWsr2iEFNEbRuqmNhDjpsZS\",\n \"amount\": \"1.0\",\n \"claim_id\": \"1812d3275894f62a055d59189a75698a071108af\",\n \"claim_op\": \"update\",\n \"confirmations\": 5,\n \"height\": 210,\n \"is_change\": false,\n \"is_mine\": true,\n \"meta\": {},\n \"name\": \"@channel\",\n \"normalized_name\": \"@channel\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://@channel#1812d3275894f62a055d59189a75698a071108af\",\n \"timestamp\": 1567524491,\n \"txid\": \"986dbf145a5320fe0047b3404216ddae76bb9e915895ebb04dda9c4e1b676be7\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a034200044974cd9d7098183f8bc9005f3957a4dbfc1ede19044311337fe9f645f256a7a4013c6a142497590bd8461fc50ce6b489453686422079c334bd5f8316b335365e\",\n \"public_key_id\": \"mrne5J4YN1SYYE3qNAAwzEVHAxnZX4AKHp\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n }\n ],\n \"page\": 1,\n \"page_size\": 20,\n \"total_items\": 2,\n \"total_pages\": 1\n }\n}"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -1693,14 +1693,14 @@
|
||||
"curl": "curl -d'{\"method\": \"claim_search\", \"params\": {\"channel\": \"@channel\", \"channel_ids\": [], \"not_channel_ids\": [], \"has_channel_signature\": false, \"valid_channel_signature\": false, \"invalid_channel_signature\": false, \"is_controlling\": false, \"stream_types\": [], \"media_types\": [], \"any_tags\": [], \"all_tags\": [], \"not_tags\": [], \"any_languages\": [], \"all_languages\": [], \"not_languages\": [], \"any_locations\": [], \"all_locations\": [], \"not_locations\": [], \"order_by\": []}}' http://localhost:5279/",
|
||||
"lbrynet": "lbrynet claim search --channel=@channel",
|
||||
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"claim_search\", \"params\": {\"channel\": \"@channel\", \"channel_ids\": [], \"not_channel_ids\": [], \"has_channel_signature\": false, \"valid_channel_signature\": false, \"invalid_channel_signature\": false, \"is_controlling\": false, \"stream_types\": [], \"media_types\": [], \"any_tags\": [], \"all_tags\": [], \"not_tags\": [], \"any_languages\": [], \"all_languages\": [], \"not_languages\": [], \"any_locations\": [], \"all_locations\": [], \"not_locations\": [], \"order_by\": []}}).json()",
|
||||
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"items\": [\n {\n \"address\": \"mhUNYMksuH5HFj2DUG1DsLAtMMaup1cgqn\",\n \"amount\": \"1.0\",\n \"canonical_url\": \"lbry://@channel#c/astream#6\",\n \"claim_id\": \"68fde0328b1a267b3815ce974a6329b159619092\",\n \"claim_op\": \"update\",\n \"confirmations\": 1,\n \"height\": 214,\n \"is_channel_signature_valid\": true,\n \"meta\": {\n \"activation_height\": 213,\n \"creation_height\": 213,\n \"creation_timestamp\": 1565587608,\n \"effective_amount\": \"1.0\",\n \"expiration_height\": 263187,\n \"is_controlling\": true,\n \"support_amount\": \"0.0\",\n \"take_over_height\": 213,\n \"trending_global\": 0.0,\n \"trending_group\": 0,\n \"trending_local\": 0.0,\n \"trending_mixed\": 0.0\n },\n \"name\": \"astream\",\n \"normalized_name\": \"astream\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://astream#68fde0328b1a267b3815ce974a6329b159619092\",\n \"short_url\": \"lbry://astream#6\",\n \"signing_channel\": {\n \"address\": \"mvE3pR2rH5mP1Hx8UEipnPt3Atp89tXqVw\",\n \"amount\": \"1.0\",\n \"canonical_url\": \"lbry://@channel#c\",\n \"claim_id\": \"cbf954c2782b7cf571f7aa1de960202057618727\",\n \"claim_op\": \"update\",\n \"confirmations\": 5,\n \"height\": 210,\n \"meta\": {\n \"activation_height\": 209,\n \"claims_in_channel\": 1,\n \"creation_height\": 209,\n \"creation_timestamp\": 1565587607,\n \"effective_amount\": \"1.0\",\n \"expiration_height\": 263183,\n \"is_controlling\": true,\n \"support_amount\": \"0.0\",\n \"take_over_height\": 209,\n \"trending_global\": 0.0,\n \"trending_group\": 0,\n \"trending_local\": 0.0,\n \"trending_mixed\": 0.0\n },\n \"name\": \"@channel\",\n \"normalized_name\": \"@channel\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://@channel#cbf954c2782b7cf571f7aa1de960202057618727\",\n \"short_url\": \"lbry://@channel#c\",\n \"timestamp\": 1565587607,\n \"txid\": \"794fc94e7ac645d5fc06c14e5ac9be9d9afa53cd540a349ee276662b23e21396\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a0342000404b644588c6a32f425fa8c2c3b0404898c79d405d1e90783adcf9a2bdbad505012f1e6be38f7837b69d5f2a1a1959135701780f01fc91c396158c4b1b9b1e304\",\n \"public_key_id\": \"mrPWGtFam2wwv7D1QRgXXrXePLqUGdKaCb\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n },\n \"timestamp\": 1565587608,\n \"txid\": \"55a247d733323e8645656c1c817ac34411fafb5493f9c528091897b6ca0e5400\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpwc0xotjc\",\n \"sd_hash\": \"ca7f2e83a2d275e25151463521e893b8812aa0b061ab299fb9877521c0a2ced15927eeca4f50680d8ea5e03ae6b6c3f2\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"value_type\": \"stream\"\n }\n ],\n \"page\": 1,\n \"page_size\": 10,\n \"total_items\": 1,\n \"total_pages\": 1\n }\n}"
|
||||
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"items\": [\n {\n \"address\": \"mqwocM9E8dcY9aHCaCGG6HXB8Pd3hA9KjF\",\n \"amount\": \"1.0\",\n \"canonical_url\": \"lbry://@channel#1/astream#b\",\n \"claim_id\": \"bfb7d50e084d6d246ca9ff909c401aab30a6f9a6\",\n \"claim_op\": \"update\",\n \"confirmations\": 1,\n \"height\": 214,\n \"is_channel_signature_valid\": true,\n \"meta\": {\n \"activation_height\": 213,\n \"creation_height\": 213,\n \"creation_timestamp\": 1567524492,\n \"effective_amount\": \"1.0\",\n \"expiration_height\": 263187,\n \"is_controlling\": true,\n \"support_amount\": \"0.0\",\n \"take_over_height\": 213,\n \"trending_global\": 0.0,\n \"trending_group\": 0,\n \"trending_local\": 0.0,\n \"trending_mixed\": 0.0\n },\n \"name\": \"astream\",\n \"normalized_name\": \"astream\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://astream#bfb7d50e084d6d246ca9ff909c401aab30a6f9a6\",\n \"short_url\": \"lbry://astream#b\",\n \"signing_channel\": {\n \"address\": \"mw6SpJDWJeYTWsr2iEFNEbRuqmNhDjpsZS\",\n \"amount\": \"1.0\",\n \"canonical_url\": \"lbry://@channel#1\",\n \"claim_id\": \"1812d3275894f62a055d59189a75698a071108af\",\n \"claim_op\": \"update\",\n \"confirmations\": 5,\n \"height\": 210,\n \"meta\": {\n \"activation_height\": 209,\n \"claims_in_channel\": 1,\n \"creation_height\": 209,\n \"creation_timestamp\": 1567524491,\n \"effective_amount\": \"1.0\",\n \"expiration_height\": 263183,\n \"is_controlling\": true,\n \"support_amount\": \"0.0\",\n \"take_over_height\": 209,\n \"trending_global\": 0.0,\n \"trending_group\": 0,\n \"trending_local\": 0.0,\n \"trending_mixed\": 0.0\n },\n \"name\": \"@channel\",\n \"normalized_name\": \"@channel\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://@channel#1812d3275894f62a055d59189a75698a071108af\",\n \"short_url\": \"lbry://@channel#1\",\n \"timestamp\": 1567524491,\n \"txid\": \"986dbf145a5320fe0047b3404216ddae76bb9e915895ebb04dda9c4e1b676be7\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a034200044974cd9d7098183f8bc9005f3957a4dbfc1ede19044311337fe9f645f256a7a4013c6a142497590bd8461fc50ce6b489453686422079c334bd5f8316b335365e\",\n \"public_key_id\": \"mrne5J4YN1SYYE3qNAAwzEVHAxnZX4AKHp\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n },\n \"timestamp\": 1567524492,\n \"txid\": \"f3338742c2b4cf0e35b7ffa73aea3e9da786926cf82f07d3100e09d04ec3f231\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpmjego0ff\",\n \"sd_hash\": \"2ab7bbd96cb5db43df9ff909c0555dd8a132866355768c41d24f2b4be7c0478ae5f82d2c853e95c9b1179c6743e4bb37\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"value_type\": \"stream\"\n }\n ],\n \"page\": 1,\n \"page_size\": 10,\n \"total_items\": 1,\n \"total_pages\": 1\n }\n}"
|
||||
},
|
||||
{
|
||||
"title": "Search for claims matching a name",
|
||||
"curl": "curl -d'{\"method\": \"claim_search\", \"params\": {\"name\": \"astream\", \"channel_ids\": [], \"not_channel_ids\": [], \"has_channel_signature\": false, \"valid_channel_signature\": false, \"invalid_channel_signature\": false, \"is_controlling\": false, \"stream_types\": [], \"media_types\": [], \"any_tags\": [], \"all_tags\": [], \"not_tags\": [], \"any_languages\": [], \"all_languages\": [], \"not_languages\": [], \"any_locations\": [], \"all_locations\": [], \"not_locations\": [], \"order_by\": []}}' http://localhost:5279/",
|
||||
"lbrynet": "lbrynet claim search --name=\"astream\"",
|
||||
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"claim_search\", \"params\": {\"name\": \"astream\", \"channel_ids\": [], \"not_channel_ids\": [], \"has_channel_signature\": false, \"valid_channel_signature\": false, \"invalid_channel_signature\": false, \"is_controlling\": false, \"stream_types\": [], \"media_types\": [], \"any_tags\": [], \"all_tags\": [], \"not_tags\": [], \"any_languages\": [], \"all_languages\": [], \"not_languages\": [], \"any_locations\": [], \"all_locations\": [], \"not_locations\": [], \"order_by\": []}}).json()",
|
||||
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"items\": [\n {\n \"address\": \"mhUNYMksuH5HFj2DUG1DsLAtMMaup1cgqn\",\n \"amount\": \"1.0\",\n \"canonical_url\": \"lbry://@channel#c/astream#6\",\n \"claim_id\": \"68fde0328b1a267b3815ce974a6329b159619092\",\n \"claim_op\": \"update\",\n \"confirmations\": 1,\n \"height\": 214,\n \"is_channel_signature_valid\": true,\n \"meta\": {\n \"activation_height\": 213,\n \"creation_height\": 213,\n \"creation_timestamp\": 1565587608,\n \"effective_amount\": \"1.0\",\n \"expiration_height\": 263187,\n \"is_controlling\": true,\n \"support_amount\": \"0.0\",\n \"take_over_height\": 213,\n \"trending_global\": 0.0,\n \"trending_group\": 0,\n \"trending_local\": 0.0,\n \"trending_mixed\": 0.0\n },\n \"name\": \"astream\",\n \"normalized_name\": \"astream\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://astream#68fde0328b1a267b3815ce974a6329b159619092\",\n \"short_url\": \"lbry://astream#6\",\n \"signing_channel\": {\n \"address\": \"mvE3pR2rH5mP1Hx8UEipnPt3Atp89tXqVw\",\n \"amount\": \"1.0\",\n \"canonical_url\": \"lbry://@channel#c\",\n \"claim_id\": \"cbf954c2782b7cf571f7aa1de960202057618727\",\n \"claim_op\": \"update\",\n \"confirmations\": 5,\n \"height\": 210,\n \"meta\": {\n \"activation_height\": 209,\n \"claims_in_channel\": 1,\n \"creation_height\": 209,\n \"creation_timestamp\": 1565587607,\n \"effective_amount\": \"1.0\",\n \"expiration_height\": 263183,\n \"is_controlling\": true,\n \"support_amount\": \"0.0\",\n \"take_over_height\": 209,\n \"trending_global\": 0.0,\n \"trending_group\": 0,\n \"trending_local\": 0.0,\n \"trending_mixed\": 0.0\n },\n \"name\": \"@channel\",\n \"normalized_name\": \"@channel\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://@channel#cbf954c2782b7cf571f7aa1de960202057618727\",\n \"short_url\": \"lbry://@channel#c\",\n \"timestamp\": 1565587607,\n \"txid\": \"794fc94e7ac645d5fc06c14e5ac9be9d9afa53cd540a349ee276662b23e21396\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a0342000404b644588c6a32f425fa8c2c3b0404898c79d405d1e90783adcf9a2bdbad505012f1e6be38f7837b69d5f2a1a1959135701780f01fc91c396158c4b1b9b1e304\",\n \"public_key_id\": \"mrPWGtFam2wwv7D1QRgXXrXePLqUGdKaCb\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n },\n \"timestamp\": 1565587608,\n \"txid\": \"55a247d733323e8645656c1c817ac34411fafb5493f9c528091897b6ca0e5400\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpwc0xotjc\",\n \"sd_hash\": \"ca7f2e83a2d275e25151463521e893b8812aa0b061ab299fb9877521c0a2ced15927eeca4f50680d8ea5e03ae6b6c3f2\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"value_type\": \"stream\"\n }\n ],\n \"page\": 1,\n \"page_size\": 10,\n \"total_items\": 1,\n \"total_pages\": 1\n }\n}"
|
||||
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"items\": [\n {\n \"address\": \"mqwocM9E8dcY9aHCaCGG6HXB8Pd3hA9KjF\",\n \"amount\": \"1.0\",\n \"canonical_url\": \"lbry://@channel#1/astream#b\",\n \"claim_id\": \"bfb7d50e084d6d246ca9ff909c401aab30a6f9a6\",\n \"claim_op\": \"update\",\n \"confirmations\": 1,\n \"height\": 214,\n \"is_channel_signature_valid\": true,\n \"meta\": {\n \"activation_height\": 213,\n \"creation_height\": 213,\n \"creation_timestamp\": 1567524492,\n \"effective_amount\": \"1.0\",\n \"expiration_height\": 263187,\n \"is_controlling\": true,\n \"support_amount\": \"0.0\",\n \"take_over_height\": 213,\n \"trending_global\": 0.0,\n \"trending_group\": 0,\n \"trending_local\": 0.0,\n \"trending_mixed\": 0.0\n },\n \"name\": \"astream\",\n \"normalized_name\": \"astream\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://astream#bfb7d50e084d6d246ca9ff909c401aab30a6f9a6\",\n \"short_url\": \"lbry://astream#b\",\n \"signing_channel\": {\n \"address\": \"mw6SpJDWJeYTWsr2iEFNEbRuqmNhDjpsZS\",\n \"amount\": \"1.0\",\n \"canonical_url\": \"lbry://@channel#1\",\n \"claim_id\": \"1812d3275894f62a055d59189a75698a071108af\",\n \"claim_op\": \"update\",\n \"confirmations\": 5,\n \"height\": 210,\n \"meta\": {\n \"activation_height\": 209,\n \"claims_in_channel\": 1,\n \"creation_height\": 209,\n \"creation_timestamp\": 1567524491,\n \"effective_amount\": \"1.0\",\n \"expiration_height\": 263183,\n \"is_controlling\": true,\n \"support_amount\": \"0.0\",\n \"take_over_height\": 209,\n \"trending_global\": 0.0,\n \"trending_group\": 0,\n \"trending_local\": 0.0,\n \"trending_mixed\": 0.0\n },\n \"name\": \"@channel\",\n \"normalized_name\": \"@channel\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://@channel#1812d3275894f62a055d59189a75698a071108af\",\n \"short_url\": \"lbry://@channel#1\",\n \"timestamp\": 1567524491,\n \"txid\": \"986dbf145a5320fe0047b3404216ddae76bb9e915895ebb04dda9c4e1b676be7\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a034200044974cd9d7098183f8bc9005f3957a4dbfc1ede19044311337fe9f645f256a7a4013c6a142497590bd8461fc50ce6b489453686422079c334bd5f8316b335365e\",\n \"public_key_id\": \"mrne5J4YN1SYYE3qNAAwzEVHAxnZX4AKHp\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n },\n \"timestamp\": 1567524492,\n \"txid\": \"f3338742c2b4cf0e35b7ffa73aea3e9da786926cf82f07d3100e09d04ec3f231\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpmjego0ff\",\n \"sd_hash\": \"2ab7bbd96cb5db43df9ff909c0555dd8a132866355768c41d24f2b4be7c0478ae5f82d2c853e95c9b1179c6743e4bb37\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"value_type\": \"stream\"\n }\n ],\n \"page\": 1,\n \"page_size\": 10,\n \"total_items\": 1,\n \"total_pages\": 1\n }\n}"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1716,11 +1716,11 @@
|
||||
{
|
||||
"name": "comment_id",
|
||||
"type": "str",
|
||||
"description": "The ID of the comment to be deleted.",
|
||||
"description": "The ID of the comment to be abandoned.",
|
||||
"is_required": true
|
||||
}
|
||||
],
|
||||
"returns": "(dict) Object with the `comment_id` passed in as the key, and a flag indicating if it was deleted\n {\n <comment_id> (str): {\n \"deleted\": (bool)\n }\n }",
|
||||
"returns": "(dict) Object with the `comment_id` passed in as the key, and a flag indicating if it was abandoned\n {\n <comment_id> (str): {\n \"abandoned\": (bool)\n }\n }",
|
||||
"examples": []
|
||||
},
|
||||
{
|
||||
@@ -1767,6 +1767,20 @@
|
||||
"returns": "(dict) Comment object if successfully made, (None) otherwise\n {\n \"comment\": (str) The actual string as inputted by the user,\n \"comment_id\": (str) The Comment's unique identifier,\n \"channel_name\": (str) Name of the channel this was posted under, prepended with a '@',\n \"channel_id\": (str) The Channel Claim ID that this comment was posted under,\n \"signature\": (str) The signature of the comment,\n \"channel_url\": (str) Channel's URI in the ClaimTrie,\n \"parent_id\": (str) Comment this is replying to, (None) if this is the root,\n \"timestamp\": (int) The time at which comment was entered into the server at, in nanoseconds.\n }",
|
||||
"examples": []
|
||||
},
|
||||
{
|
||||
"name": "comment_hide",
|
||||
"description": "Hide a comment published to a claim you control.",
|
||||
"arguments": [
|
||||
{
|
||||
"name": "comment_ids",
|
||||
"type": "str, list",
|
||||
"description": "one or more comment_id to hide.",
|
||||
"is_required": false
|
||||
}
|
||||
],
|
||||
"returns": "(dict) keyed by comment_id, containing success info\n '<comment_id>': {\n \"hidden\": (bool) flag indicating if comment_id was hidden\n }",
|
||||
"examples": []
|
||||
},
|
||||
{
|
||||
"name": "comment_list",
|
||||
"description": "List comments associated with a claim.",
|
||||
@@ -1806,6 +1820,18 @@
|
||||
"type": "bool",
|
||||
"description": "Only include comments with valid signatures. [Warning: Paginated total size will not change, even if list reduces]",
|
||||
"is_required": false
|
||||
},
|
||||
{
|
||||
"name": "visible",
|
||||
"type": "bool",
|
||||
"description": "Select only Visisble Comments",
|
||||
"is_required": false
|
||||
},
|
||||
{
|
||||
"name": "hidden",
|
||||
"type": "bool",
|
||||
"description": "Select only Hidden Comments",
|
||||
"is_required": false
|
||||
}
|
||||
],
|
||||
"returns": "(dict) Containing the list, and information about the paginated content:\n {\n \"page\": \"Page number of the current items.\",\n \"page_size\": \"Number of items to show on a page.\",\n \"total_pages\": \"Total number of pages.\",\n \"total_items\": \"Total number of items.\",\n \"items\": \"A List of dict objects representing comments.\"\n [\n {\n \"comment\": (str) The actual string as inputted by the user,\n \"comment_id\": (str) The Comment's unique identifier,\n \"channel_name\": (str) Name of the channel this was posted under, prepended with a '@',\n \"channel_id\": (str) The Channel Claim ID that this comment was posted under,\n \"signature\": (str) The signature of the comment,\n \"channel_url\": (str) Channel's URI in the ClaimTrie,\n \"parent_id\": (str) Comment this is replying to, (None) if this is the root,\n \"timestamp\": (int) The time at which comment was entered into the server at, in nanoseconds.\n },\n ...\n ]\n }",
|
||||
@@ -1897,9 +1923,9 @@
|
||||
"examples": [
|
||||
{
|
||||
"title": "Delete a file",
|
||||
"curl": "curl -d'{\"method\": \"file_delete\", \"params\": {\"delete_from_download_dir\": false, \"delete_all\": false, \"claim_id\": \"68fde0328b1a267b3815ce974a6329b159619092\"}}' http://localhost:5279/",
|
||||
"lbrynet": "lbrynet file delete --claim_id=\"68fde0328b1a267b3815ce974a6329b159619092\"",
|
||||
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"file_delete\", \"params\": {\"delete_from_download_dir\": false, \"delete_all\": false, \"claim_id\": \"68fde0328b1a267b3815ce974a6329b159619092\"}}).json()",
|
||||
"curl": "curl -d'{\"method\": \"file_delete\", \"params\": {\"delete_from_download_dir\": false, \"delete_all\": false, \"claim_id\": \"bfb7d50e084d6d246ca9ff909c401aab30a6f9a6\"}}' http://localhost:5279/",
|
||||
"lbrynet": "lbrynet file delete --claim_id=\"bfb7d50e084d6d246ca9ff909c401aab30a6f9a6\"",
|
||||
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"file_delete\", \"params\": {\"delete_from_download_dir\": false, \"delete_all\": false, \"claim_id\": \"bfb7d50e084d6d246ca9ff909c401aab30a6f9a6\"}}).json()",
|
||||
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": true\n}"
|
||||
}
|
||||
]
|
||||
@@ -2006,14 +2032,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\": \"cbf954c2782b7cf571f7aa1de960202057618727\",\n \"channel_name\": \"@channel\",\n \"claim_id\": \"68fde0328b1a267b3815ce974a6329b159619092\",\n \"claim_name\": \"astream\",\n \"completed\": true,\n \"confirmations\": -1,\n \"content_fee\": null,\n \"download_directory\": null,\n \"download_path\": null,\n \"file_name\": null,\n \"height\": -1,\n \"key\": \"b362c109c1773e239c7b8046b68baca1\",\n \"metadata\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpwc0xotjc\",\n \"sd_hash\": \"ca7f2e83a2d275e25151463521e893b8812aa0b061ab299fb9877521c0a2ced15927eeca4f50680d8ea5e03ae6b6c3f2\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"mime_type\": \"application/octet-stream\",\n \"nout\": 0,\n \"outpoint\": \"55a247d733323e8645656c1c817ac34411fafb5493f9c528091897b6ca0e5400:0\",\n \"points_paid\": 0.0,\n \"protobuf\": \"0127876157202060e91daaf771f57c2b78c254f9cb399c380097dccb958b0a22cddccfb1ff04aa93fa4022c09f2063b86e67ed1b5bc8546dfec3d1faf5c2c75c365722f78c508ba288b1f0cb3913fd391ff1796a1c0a90010a8d010a30fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd120b746d70776330786f746a63180b22186170706c69636174696f6e2f6f637465742d73747265616d3230ca7f2e83a2d275e25151463521e893b8812aa0b061ab299fb9877521c0a2ced15927eeca4f50680d8ea5e03ae6b6c3f2\",\n \"sd_hash\": \"ca7f2e83a2d275e25151463521e893b8812aa0b061ab299fb9877521c0a2ced15927eeca4f50680d8ea5e03ae6b6c3f2\",\n \"status\": \"finished\",\n \"stopped\": true,\n \"stream_hash\": \"b2749b74dd58556c9193970be68b3c439dd593e7f117cdbba75d3073307fdfa91e811ff9d3f71336eccefadb9d27effa\",\n \"stream_name\": \"tmpwc0xotjc\",\n \"streaming_url\": \"http://localhost:5280/stream/ca7f2e83a2d275e25151463521e893b8812aa0b061ab299fb9877521c0a2ced15927eeca4f50680d8ea5e03ae6b6c3f2\",\n \"suggested_file_name\": \"tmpwc0xotjc\",\n \"timestamp\": null,\n \"total_bytes\": 16,\n \"total_bytes_lower_bound\": 0,\n \"txid\": \"55a247d733323e8645656c1c817ac34411fafb5493f9c528091897b6ca0e5400\",\n \"written_bytes\": 0\n },\n {\n \"blobs_completed\": 1,\n \"blobs_in_stream\": 1,\n \"blobs_remaining\": 0,\n \"channel_claim_id\": \"cbf954c2782b7cf571f7aa1de960202057618727\",\n \"channel_name\": \"@channel\",\n \"claim_id\": \"5cfb92c3e6a80aedee5282c3f64b565bc6965562\",\n \"claim_name\": \"blank-image\",\n \"completed\": false,\n \"confirmations\": -1,\n \"content_fee\": null,\n \"download_directory\": null,\n \"download_path\": null,\n \"file_name\": null,\n \"height\": -1,\n \"key\": \"6e4465bcef7cb99a26a29b8d3e016318\",\n \"metadata\": {\n \"author\": \"Picaso\",\n \"description\": \"A blank PNG that is 5x7.\",\n \"fee\": {\n \"address\": \"mhPFLtT7YzmNfMuQYr4PQXAJdtaTKWRLFy\",\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\": \"1565587584\",\n \"source\": {\n \"hash\": \"6c7df435d412c603390f593ef658c199817c7830ba3f16b7eadd8f99fa50e85dbd0d2b3dc61eadc33fe096e3872d1545\",\n \"media_type\": \"image/png\",\n \"name\": \"tmpnkt_49bq.png\",\n \"sd_hash\": \"eda7090b2d59beb0d77de489961cb73bbc73bbbb80d2c3c0e5f547b8c07dc0eded9627ce12872ca86a20a51d54ae3c4b\",\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\": \"474e26f1aceebbdbbbad02afd37dd39aa3eb221098fa8a4073b1117264422e98:0\",\n \"points_paid\": 0.0,\n \"protobuf\": \"0127876157202060e91daaf771f57c2b78c254f9cb24eda15eb1995dfe4ea874fa93396c62e1fe82612e6b9b786ea0c55166e98e7880da5e3b48ef29ab4d1a9c83f71482c22a4acad548c27a5f5643550d0434f3b00ae6010a82010a306c7df435d412c603390f593ef658c199817c7830ba3f16b7eadd8f99fa50e85Line 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\": \"1812d3275894f62a055d59189a75698a071108af\",\n \"channel_name\": \"@channel\",\n \"claim_id\": \"bfb7d50e084d6d246ca9ff909c401aab30a6f9a6\",\n \"claim_name\": \"astream\",\n \"completed\": true,\n \"confirmations\": -1,\n \"content_fee\": null,\n \"download_directory\": null,\n \"download_path\": null,\n \"file_name\": null,\n \"height\": -1,\n \"key\": \"44c98cff66e9387514d212369d4af15e\",\n \"metadata\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpmjego0ff\",\n \"sd_hash\": \"2ab7bbd96cb5db43df9ff909c0555dd8a132866355768c41d24f2b4be7c0478ae5f82d2c853e95c9b1179c6743e4bb37\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"mime_type\": \"application/octet-stream\",\n \"nout\": 0,\n \"outpoint\": \"f3338742c2b4cf0e35b7ffa73aea3e9da786926cf82f07d3100e09d04ec3f231:0\",\n \"points_paid\": 0.0,\n \"protobuf\": \"01af0811078a69759a18595d052af6945827d31218a49f0b990dfb596d464fa5c166a752b4835b01f02dcabd712d4345b09c18ce4096395d25caf4fb962732f54d58df839f9dd7cc2ef1d4303c89e4dd553865ed060a90010a8d010a30fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd120b746d706d6a65676f306666180b22186170706c69636174696f6e2f6f637465742d73747265616d32302ab7bbd96cb5db43df9ff909c0555dd8a132866355768c41d24f2b4be7c0478ae5f82d2c853e95c9b1179c6743e4bb37\",\n \"sd_hash\": \"2ab7bbd96cb5db43df9ff909c0555dd8a132866355768c41d24f2b4be7c0478ae5f82d2c853e95c9b1179c6743e4bb37\",\n \"status\": \"finished\",\n \"stopped\": true,\n \"stream_hash\": \"d2fdfe280a77e5dd71f82cd531782ec5f71db1b2f9b6bf4da71240b5ad6fb21367d4b53e6f84fa83cc190aff004dd7bd\",\n \"stream_name\": \"tmpmjego0ff\",\n \"streaming_url\": \"http://localhost:5280/stream/2ab7bbd96cb5db43df9ff909c0555dd8a132866355768c41d24f2b4be7c0478ae5f82d2c853e95c9b1179c6743e4bb37\",\n \"suggested_file_name\": \"tmpmjego0ff\",\n \"timestamp\": null,\n \"total_bytes\": 16,\n \"total_bytes_lower_bound\": 0,\n \"txid\": \"f3338742c2b4cf0e35b7ffa73aea3e9da786926cf82f07d3100e09d04ec3f231\",\n \"written_bytes\": 0\n },\n {\n \"blobs_completed\": 1,\n \"blobs_in_stream\": 1,\n \"blobs_remaining\": 0,\n \"channel_claim_id\": \"1812d3275894f62a055d59189a75698a071108af\",\n \"channel_name\": \"@channel\",\n \"claim_id\": \"0e08f286e3e5cf0b17d3fa64da93fbf96b0e9c90\",\n \"claim_name\": \"blank-image\",\n \"completed\": false,\n \"confirmations\": -1,\n \"content_fee\": null,\n \"download_directory\": null,\n \"download_path\": null,\n \"file_name\": null,\n \"height\": -1,\n \"key\": \"9625cf71e26cdbc140dcec6d6cbfc46e\",\n \"metadata\": {\n \"author\": \"Picaso\",\n \"description\": \"A blank PNG that is 5x7.\",\n \"fee\": {\n \"address\": \"n4GBt198ctM4KF1AJGJG8ppxAeFyXFfut9\",\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\": \"1567524468\",\n \"source\": {\n \"hash\": \"6c7df435d412c603390f593ef658c199817c7830ba3f16b7eadd8f99fa50e85dbd0d2b3dc61eadc33fe096e3872d1545\",\n \"media_type\": \"image/png\",\n \"name\": \"tmpg_6t0r6a.png\",\n \"sd_hash\": \"019de60de1c0e860ae907dfbf13cd4a618a1acb9fb107e09bcaee3a6a7b2165a2a91e740a0fc9d4a4e613a6ed496bc33\",\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\": \"55d87be458bd1a9aa960dd914b7f5c6d1b118d65d8b04477f705716d33091530:0\",\n \"points_paid\": 0.0,\n \"protobuf\": \"01af0811078a69759a18595d052af6945827d312183830ab666b25817d8432e95af7bb26baed712eeca26420f81c8f8255ca008c86dbb6c771a21cbc97d0f460f7b4d4243e40a26d66f77c615f0f9cb4f99a228a830ae6010a82010a306c7df435d412c603390f593ef658c199817c7830ba3f16b7eadd8f99fa50e85Line truncated
|
||||
},
|
||||
{
|
||||
"title": "List files matching a parameter",
|
||||
"curl": "curl -d'{\"method\": \"file_list\", \"params\": {\"claim_id\": \"68fde0328b1a267b3815ce974a6329b159619092\", \"reverse\": false}}' http://localhost:5279/",
|
||||
"lbrynet": "lbrynet file list --claim_id=\"68fde0328b1a267b3815ce974a6329b159619092\"",
|
||||
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"file_list\", \"params\": {\"claim_id\": \"68fde0328b1a267b3815ce974a6329b159619092\", \"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\": \"cbf954c2782b7cf571f7aa1de960202057618727\",\n \"channel_name\": \"@channel\",\n \"claim_id\": \"68fde0328b1a267b3815ce974a6329b159619092\",\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\": \"b362c109c1773e239c7b8046b68baca1\",\n \"metadata\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpwc0xotjc\",\n \"sd_hash\": \"ca7f2e83a2d275e25151463521e893b8812aa0b061ab299fb9877521c0a2ced15927eeca4f50680d8ea5e03ae6b6c3f2\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"mime_type\": \"application/octet-stream\",\n \"nout\": 0,\n \"outpoint\": \"55a247d733323e8645656c1c817ac34411fafb5493f9c528091897b6ca0e5400:0\",\n \"points_paid\": 0.0,\n \"protobuf\": \"0127876157202060e91daaf771f57c2b78c254f9cb399c380097dccb958b0a22cddccfb1ff04aa93fa4022c09f2063b86e67ed1b5bc8546dfec3d1faf5c2c75c365722f78c508ba288b1f0cb3913fd391ff1796a1c0a90010a8d010a30fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd120b746d70776330786f746a63180b22186170706c69636174696f6e2f6f637465742d73747265616d3230ca7f2e83a2d275e25151463521e893b8812aa0b061ab299fb9877521c0a2ced15927eeca4f50680d8ea5e03ae6b6c3f2\",\n \"sd_hash\": \"ca7f2e83a2d275e25151463521e893b8812aa0b061ab299fb9877521c0a2ced15927eeca4f50680d8ea5e03ae6b6c3f2\",\n \"status\": \"finished\",\n \"stopped\": true,\n \"stream_hash\": \"b2749b74dd58556c9193970be68b3c439dd593e7f117cdbba75d3073307fdfa91e811ff9d3f71336eccefadb9d27effa\",\n \"stream_name\": \"tmpwc0xotjc\",\n \"streaming_url\": \"http://localhost:5280/stream/ca7f2e83a2d275e25151463521e893b8812aa0b061ab299fb9877521c0a2ced15927eeca4f50680d8ea5e03ae6b6c3f2\",\n \"suggested_file_name\": \"tmpwc0xotjc\",\n \"timestamp\": 1565587608,\n \"total_bytes\": 16,\n \"total_bytes_lower_bound\": 0,\n \"txid\": \"55a247d733323e8645656c1c817ac34411fafb5493f9c528091897b6ca0e5400\",\n \"written_bytes\": 0\n }\n ]\n}"
|
||||
"curl": "curl -d'{\"method\": \"file_list\", \"params\": {\"claim_id\": \"bfb7d50e084d6d246ca9ff909c401aab30a6f9a6\", \"reverse\": false}}' http://localhost:5279/",
|
||||
"lbrynet": "lbrynet file list --claim_id=\"bfb7d50e084d6d246ca9ff909c401aab30a6f9a6\"",
|
||||
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"file_list\", \"params\": {\"claim_id\": \"bfb7d50e084d6d246ca9ff909c401aab30a6f9a6\", \"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\": \"1812d3275894f62a055d59189a75698a071108af\",\n \"channel_name\": \"@channel\",\n \"claim_id\": \"bfb7d50e084d6d246ca9ff909c401aab30a6f9a6\",\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\": \"44c98cff66e9387514d212369d4af15e\",\n \"metadata\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpmjego0ff\",\n \"sd_hash\": \"2ab7bbd96cb5db43df9ff909c0555dd8a132866355768c41d24f2b4be7c0478ae5f82d2c853e95c9b1179c6743e4bb37\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"mime_type\": \"application/octet-stream\",\n \"nout\": 0,\n \"outpoint\": \"f3338742c2b4cf0e35b7ffa73aea3e9da786926cf82f07d3100e09d04ec3f231:0\",\n \"points_paid\": 0.0,\n \"protobuf\": \"01af0811078a69759a18595d052af6945827d31218a49f0b990dfb596d464fa5c166a752b4835b01f02dcabd712d4345b09c18ce4096395d25caf4fb962732f54d58df839f9dd7cc2ef1d4303c89e4dd553865ed060a90010a8d010a30fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd120b746d706d6a65676f306666180b22186170706c69636174696f6e2f6f637465742d73747265616d32302ab7bbd96cb5db43df9ff909c0555dd8a132866355768c41d24f2b4be7c0478ae5f82d2c853e95c9b1179c6743e4bb37\",\n \"sd_hash\": \"2ab7bbd96cb5db43df9ff909c0555dd8a132866355768c41d24f2b4be7c0478ae5f82d2c853e95c9b1179c6743e4bb37\",\n \"status\": \"finished\",\n \"stopped\": true,\n \"stream_hash\": \"d2fdfe280a77e5dd71f82cd531782ec5f71db1b2f9b6bf4da71240b5ad6fb21367d4b53e6f84fa83cc190aff004dd7bd\",\n \"stream_name\": \"tmpmjego0ff\",\n \"streaming_url\": \"http://localhost:5280/stream/2ab7bbd96cb5db43df9ff909c0555dd8a132866355768c41d24f2b4be7c0478ae5f82d2c853e95c9b1179c6743e4bb37\",\n \"suggested_file_name\": \"tmpmjego0ff\",\n \"timestamp\": 1567524492,\n \"total_bytes\": 16,\n \"total_bytes_lower_bound\": 0,\n \"txid\": \"f3338742c2b4cf0e35b7ffa73aea3e9da786926cf82f07d3100e09d04ec3f231\",\n \"written_bytes\": 0\n }\n ]\n}"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -2130,10 +2156,10 @@
|
||||
"examples": [
|
||||
{
|
||||
"title": "Save a file to the downloads directory",
|
||||
"curl": "curl -d'{\"method\": \"file_save\", \"params\": {\"sd_hash\": \"ca7f2e83a2d275e25151463521e893b8812aa0b061ab299fb9877521c0a2ced15927eeca4f50680d8ea5e03ae6b6c3f2\"}}' http://localhost:5279/",
|
||||
"lbrynet": "lbrynet file save --sd_hash=\"ca7f2e83a2d275e25151463521e893b8812aa0b061ab299fb9877521c0a2ced15927eeca4f50680d8ea5e03ae6b6c3f2\"",
|
||||
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"file_save\", \"params\": {\"sd_hash\": \"ca7f2e83a2d275e25151463521e893b8812aa0b061ab299fb9877521c0a2ced15927eeca4f50680d8ea5e03ae6b6c3f2\"}}).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\": \"cbf954c2782b7cf571f7aa1de960202057618727\",\n \"channel_name\": \"@channel\",\n \"claim_id\": \"68fde0328b1a267b3815ce974a6329b159619092\",\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\": \"b362c109c1773e239c7b8046b68baca1\",\n \"metadata\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpwc0xotjc\",\n \"sd_hash\": \"ca7f2e83a2d275e25151463521e893b8812aa0b061ab299fb9877521c0a2ced15927eeca4f50680d8ea5e03ae6b6c3f2\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"mime_type\": \"application/octet-stream\",\n \"nout\": 0,\n \"outpoint\": \"55a247d733323e8645656c1c817ac34411fafb5493f9c528091897b6ca0e5400:0\",\n \"points_paid\": 0.0,\n \"protobuf\": \"0127876157202060e91daaf771f57c2b78c254f9cb399c380097dccb958b0a22cddccfb1ff04aa93fa4022c09f2063b86e67ed1b5bc8546dfec3d1faf5c2c75c365722f78c508ba288b1f0cb3913fd391ff1796a1c0a90010a8d010a30fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd120b746d70776330786f746a63180b22186170706c69636174696f6e2f6f637465742d73747265616d3230ca7f2e83a2d275e25151463521e893b8812aa0b061ab299fb9877521c0a2ced15927eeca4f50680d8ea5e03ae6b6c3f2\",\n \"sd_hash\": \"ca7f2e83a2d275e25151463521e893b8812aa0b061ab299fb9877521c0a2ced15927eeca4f50680d8ea5e03ae6b6c3f2\",\n \"status\": \"running\",\n \"stopped\": false,\n \"stream_hash\": \"b2749b74dd58556c9193970be68b3c439dd593e7f117cdbba75d3073307fdfa91e811ff9d3f71336eccefadb9d27effa\",\n \"stream_name\": \"tmpwc0xotjc\",\n \"streaming_url\": \"http://localhost:5280/stream/ca7f2e83a2d275e25151463521e893b8812aa0b061ab299fb9877521c0a2ced15927eeca4f50680d8ea5e03ae6b6c3f2\",\n \"suggested_file_name\": \"tmpwc0xotjc\",\n \"timestamp\": 1565587608,\n \"total_bytes\": 16,\n \"total_bytes_lower_bound\": 0,\n \"txid\": \"55a247d733323e8645656c1c817ac34411fafb5493f9c528091897b6ca0e5400\",\n \"written_bytes\": 0\n }\n}"
|
||||
"curl": "curl -d'{\"method\": \"file_save\", \"params\": {\"sd_hash\": \"2ab7bbd96cb5db43df9ff909c0555dd8a132866355768c41d24f2b4be7c0478ae5f82d2c853e95c9b1179c6743e4bb37\"}}' http://localhost:5279/",
|
||||
"lbrynet": "lbrynet file save --sd_hash=\"2ab7bbd96cb5db43df9ff909c0555dd8a132866355768c41d24f2b4be7c0478ae5f82d2c853e95c9b1179c6743e4bb37\"",
|
||||
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"file_save\", \"params\": {\"sd_hash\": \"2ab7bbd96cb5db43df9ff909c0555dd8a132866355768c41d24f2b4be7c0478ae5f82d2c853e95c9b1179c6743e4bb37\"}}).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\": \"1812d3275894f62a055d59189a75698a071108af\",\n \"channel_name\": \"@channel\",\n \"claim_id\": \"bfb7d50e084d6d246ca9ff909c401aab30a6f9a6\",\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\": \"44c98cff66e9387514d212369d4af15e\",\n \"metadata\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpmjego0ff\",\n \"sd_hash\": \"2ab7bbd96cb5db43df9ff909c0555dd8a132866355768c41d24f2b4be7c0478ae5f82d2c853e95c9b1179c6743e4bb37\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"mime_type\": \"application/octet-stream\",\n \"nout\": 0,\n \"outpoint\": \"f3338742c2b4cf0e35b7ffa73aea3e9da786926cf82f07d3100e09d04ec3f231:0\",\n \"points_paid\": 0.0,\n \"protobuf\": \"01af0811078a69759a18595d052af6945827d31218a49f0b990dfb596d464fa5c166a752b4835b01f02dcabd712d4345b09c18ce4096395d25caf4fb962732f54d58df839f9dd7cc2ef1d4303c89e4dd553865ed060a90010a8d010a30fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd120b746d706d6a65676f306666180b22186170706c69636174696f6e2f6f637465742d73747265616d32302ab7bbd96cb5db43df9ff909c0555dd8a132866355768c41d24f2b4be7c0478ae5f82d2c853e95c9b1179c6743e4bb37\",\n \"sd_hash\": \"2ab7bbd96cb5db43df9ff909c0555dd8a132866355768c41d24f2b4be7c0478ae5f82d2c853e95c9b1179c6743e4bb37\",\n \"status\": \"running\",\n \"stopped\": false,\n \"stream_hash\": \"d2fdfe280a77e5dd71f82cd531782ec5f71db1b2f9b6bf4da71240b5ad6fb21367d4b53e6f84fa83cc190aff004dd7bd\",\n \"stream_name\": \"tmpmjego0ff\",\n \"streaming_url\": \"http://localhost:5280/stream/2ab7bbd96cb5db43df9ff909c0555dd8a132866355768c41d24f2b4be7c0478ae5f82d2c853e95c9b1179c6743e4bb37\",\n \"suggested_file_name\": \"tmpmjego0ff\",\n \"timestamp\": 1567524492,\n \"total_bytes\": 16,\n \"total_bytes_lower_bound\": 0,\n \"txid\": \"f3338742c2b4cf0e35b7ffa73aea3e9da786926cf82f07d3100e09d04ec3f231\",\n \"written_bytes\": 0\n }\n}"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -2209,6 +2235,73 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
"preference": {
|
||||
"doc": "Preferences management.",
|
||||
"commands": [
|
||||
{
|
||||
"name": "preference_get",
|
||||
"description": "Get preference value for key or all values if not key is passed in.",
|
||||
"arguments": [
|
||||
{
|
||||
"name": "key",
|
||||
"type": "str",
|
||||
"description": "key associated with value",
|
||||
"is_required": false
|
||||
},
|
||||
{
|
||||
"name": "account_id",
|
||||
"type": "str",
|
||||
"description": "id of the account containing value",
|
||||
"is_required": false
|
||||
}
|
||||
],
|
||||
"returns": "(dict) Dictionary of preference(s)",
|
||||
"examples": [
|
||||
{
|
||||
"title": "Get preferences",
|
||||
"curl": "curl -d'{\"method\": \"preference_get\", \"params\": {}}' http://localhost:5279/",
|
||||
"lbrynet": "lbrynet preference get",
|
||||
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"preference_get\", \"params\": {}}).json()",
|
||||
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"theme\": \"dark\"\n }\n}"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "preference_set",
|
||||
"description": "Set preferences",
|
||||
"arguments": [
|
||||
{
|
||||
"name": "key",
|
||||
"type": "str",
|
||||
"description": "key associated with value",
|
||||
"is_required": true
|
||||
},
|
||||
{
|
||||
"name": "value",
|
||||
"type": "str",
|
||||
"description": "key associated with value",
|
||||
"is_required": true
|
||||
},
|
||||
{
|
||||
"name": "account_id",
|
||||
"type": "str",
|
||||
"description": "id of the account containing value",
|
||||
"is_required": false
|
||||
}
|
||||
],
|
||||
"returns": "(dict) Dictionary with key/value of new preference",
|
||||
"examples": [
|
||||
{
|
||||
"title": "Set preference",
|
||||
"curl": "curl -d'{\"method\": \"preference_set\", \"params\": {\"key\": \"theme\", \"value\": \"dark\"}}' http://localhost:5279/",
|
||||
"lbrynet": "lbrynet preference set \"theme\" \"dark\"",
|
||||
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"preference_set\", \"params\": {\"key\": \"theme\", \"value\": \"dark\"}}).json()",
|
||||
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"theme\": \"dark\"\n }\n}"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"settings": {
|
||||
"doc": "Settings management.",
|
||||
"commands": [
|
||||
@@ -2223,7 +2316,7 @@
|
||||
"curl": "curl -d'{\"method\": \"settings_get\", \"params\": {}}' http://localhost:5279/",
|
||||
"lbrynet": "lbrynet settings get",
|
||||
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"settings_get\", \"params\": {}}).json()",
|
||||
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"announce_head_and_sd_only\": true,\n \"api\": \"localhost:5279\",\n \"blob_download_timeout\": 30.0,\n \"blob_lru_cache_size\": 0,\n \"blockchain_name\": \"lbrycrd_regtest\",\n \"cache_time\": 150,\n \"coin_selection_strategy\": \"standard\",\n \"comment_server\": \"https://comments.lbry.com/api\",\n \"components_to_skip\": [\n \"dht\",\n \"upnp\",\n \"hash_announcer\",\n \"peer_protocol_server\"\n ],\n \"concurrent_blob_announcers\": 10,\n \"concurrent_reflector_uploads\": 10,\n \"config\": \"/home/lex/.local/share/lbry/lbrynet/daemon_settings.yml\",\n \"data_dir\": \"/tmp/tmpdym2_jzz\",\n \"download_dir\": \"/tmp/tmpdym2_jzz\",\n \"download_timeout\": 30.0,\n \"fixed_peer_delay\": 2.0,\n \"known_dht_nodes\": [],\n \"lbryum_servers\": [\n [\n \"127.0.0.1\",\n 50001\n ]\n ],\n \"max_connections_per_download\": 4,\n \"max_key_fee\": {\n \"amount\": 50.0,\n \"currency\": \"USD\"\n },\n \"network_interface\": \"0.0.0.0\",\n \"node_rpc_timeout\": 5.0,\n \"peer_connect_timeout\": 3.0,\n \"reflect_streams\": true,\n \"reflector_servers\": [\n [\n \"127.0.0.1\",\n 5566\n ]\n ],\n \"s3_headers_depth\": 960,\n \"save_blobs\": true,\n \"save_files\": true,\n \"share_usage_data\": false,\n \"split_buckets_under_index\": 1,\n \"streaming_get\": true,\n \"streaming_server\": \"localhost:5280\",\n \"tcp_port\": 3333,\n \"track_bandwidth\": true,\n \"udp_port\": 4444,\n \"use_upnp\": false,\n \"wallet_dir\": \"/tmp/tmpdym2_jzz\"\n }\n}"
|
||||
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"announce_head_and_sd_only\": true,\n \"api\": \"localhost:5279\",\n \"blob_download_timeout\": 30.0,\n \"blob_lru_cache_size\": 0,\n \"blockchain_name\": \"lbrycrd_regtest\",\n \"cache_time\": 150,\n \"coin_selection_strategy\": \"standard\",\n \"comment_server\": \"https://comments.lbry.com/api\",\n \"components_to_skip\": [\n \"dht\",\n \"upnp\",\n \"hash_announcer\",\n \"peer_protocol_server\"\n ],\n \"concurrent_blob_announcers\": 10,\n \"concurrent_reflector_uploads\": 10,\n \"config\": \"/home/lex/.local/share/lbry/lbrynet/daemon_settings.yml\",\n \"data_dir\": \"/tmp/tmptn5ym8in\",\n \"download_dir\": \"/tmp/tmptn5ym8in\",\n \"download_timeout\": 30.0,\n \"fixed_peer_delay\": 2.0,\n \"known_dht_nodes\": [],\n \"lbryum_servers\": [\n [\n \"127.0.0.1\",\n 50001\n ]\n ],\n \"max_connections_per_download\": 4,\n \"max_key_fee\": {\n \"amount\": 50.0,\n \"currency\": \"USD\"\n },\n \"network_interface\": \"0.0.0.0\",\n \"node_rpc_timeout\": 5.0,\n \"peer_connect_timeout\": 3.0,\n \"reflect_streams\": true,\n \"reflector_servers\": [\n [\n \"127.0.0.1\",\n 5566\n ]\n ],\n \"s3_headers_depth\": 960,\n \"save_blobs\": true,\n \"save_files\": true,\n \"share_usage_data\": false,\n \"split_buckets_under_index\": 1,\n \"streaming_get\": true,\n \"streaming_server\": \"localhost:5280\",\n \"tcp_port\": 3333,\n \"track_bandwidth\": true,\n \"udp_port\": 4444,\n \"use_upnp\": false,\n \"wallet_dir\": \"/tmp/tmptn5ym8in\"\n }\n}"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -2232,7 +2325,15 @@
|
||||
"description": "Set daemon settings",
|
||||
"arguments": [],
|
||||
"returns": "(dict) Updated dictionary of daemon settings",
|
||||
"examples": []
|
||||
"examples": [
|
||||
{
|
||||
"title": "Set settings",
|
||||
"curl": "curl -d'{\"method\": \"settings_set\", \"params\": {\"key\": \"tcp_port\", \"value\": 99}}' http://localhost:5279/",
|
||||
"lbrynet": "lbrynet settings set \"tcp_port\" 99",
|
||||
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"settings_set\", \"params\": {\"key\": \"tcp_port\", \"value\": 99}}).json()",
|
||||
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"tcp_port\": 99\n }\n}"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -2284,10 +2385,10 @@
|
||||
"examples": [
|
||||
{
|
||||
"title": "Abandon a stream claim",
|
||||
"curl": "curl -d'{\"method\": \"stream_abandon\", \"params\": {\"claim_id\": \"68fde0328b1a267b3815ce974a6329b159619092\", \"preview\": false, \"blocking\": false}}' http://localhost:5279/",
|
||||
"lbrynet": "lbrynet stream abandon 68fde0328b1a267b3815ce974a6329b159619092",
|
||||
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"stream_abandon\", \"params\": {\"claim_id\": \"68fde0328b1a267b3815ce974a6329b159619092\", \"preview\": false, \"blocking\": false}}).json()",
|
||||
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"010000000100540ecab697180928c5f99354fbfa1144c37a811c6c6545863e3233d747a255000000006b483045022100e46cf7452572b43ed2357690679ced0e8715eaf9edd740870e867d35d9dccc1f022008ead1fdb16dac7f7e78c3588e9f27311ac8fa83a19b6e23811a6aeae6105286012102e5f31d1a080e94c45195eb667ca7224c90d6f2351de3c0f069189adbe7dda5d9ffffffff0134b7f505000000001976a91433f438c61fc4e8057a961399d0c623bcb367768e88ac00000000\",\n \"inputs\": [\n {\n \"address\": \"mhUNYMksuH5HFj2DUG1DsLAtMMaup1cgqn\",\n \"amount\": \"1.0\",\n \"claim_id\": \"68fde0328b1a267b3815ce974a6329b159619092\",\n \"claim_op\": \"update\",\n \"confirmations\": 3,\n \"height\": 214,\n \"is_change\": false,\n \"is_mine\": true,\n \"meta\": {},\n \"name\": \"astream\",\n \"normalized_name\": \"astream\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://astream#68fde0328b1a267b3815ce974a6329b159619092\",\n \"timestamp\": 1565587608,\n \"txid\": \"55a247d733323e8645656c1c817ac34411fafb5493f9c528091897b6ca0e5400\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpwc0xotjc\",\n \"sd_hash\": \"ca7f2e83a2d275e25151463521e893b8812aa0b061ab299fb9877521c0a2ced15927eeca4f50680d8ea5e03ae6b6c3f2\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"value_type\": \"stream\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"mkFfKfSnNuyBsFKynQvBbwdEc1TYFvVUDX\",\n \"amount\": \"0.999893\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 0,\n \"timestamp\": null,\n \"txid\": \"967b9aaf6a56a3f99b42e3eb777721e2c957f9fb3ad7495fb3e72159c5f59cfa\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.000107\",\n \"total_input\": \"1.0\",\n \"total_output\": \"0.999893\",\n \"txid\": \"967b9aaf6a56a3f99b42e3eb777721e2c957f9fb3ad7495fb3e72159c5f59cfa\"\n }\n}"
|
||||
"curl": "curl -d'{\"method\": \"stream_abandon\", \"params\": {\"claim_id\": \"bfb7d50e084d6d246ca9ff909c401aab30a6f9a6\", \"preview\": false, \"blocking\": false}}' http://localhost:5279/",
|
||||
"lbrynet": "lbrynet stream abandon bfb7d50e084d6d246ca9ff909c401aab30a6f9a6",
|
||||
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"stream_abandon\", \"params\": {\"claim_id\": \"bfb7d50e084d6d246ca9ff909c401aab30a6f9a6\", \"preview\": false, \"blocking\": false}}).json()",
|
||||
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"010000000131f2c34ed0090e10d3072ff86c9286a79d3eea3aa7ffb7350ecfb4c2428733f3000000006b4830450221008cf6f4d298c8275a90eab2e01822fedb9d12346873dfe0b44816a15121f150560220638d9b125eedbf87ed043a05df039e06b834159d1ecfb46c9da763b0390034180121023b0815369b8ef78200d00b1fef7fdd6bf0dac1a84cb34756aa390e54e07e85ecffffffff0134b7f505000000001976a9144f20673b0be85c20dfaf5e27efc880c0b31c8b0988ac00000000\",\n \"inputs\": [\n {\n \"address\": \"mqwocM9E8dcY9aHCaCGG6HXB8Pd3hA9KjF\",\n \"amount\": \"1.0\",\n \"claim_id\": \"bfb7d50e084d6d246ca9ff909c401aab30a6f9a6\",\n \"claim_op\": \"update\",\n \"confirmations\": 3,\n \"height\": 214,\n \"is_change\": false,\n \"is_mine\": true,\n \"meta\": {},\n \"name\": \"astream\",\n \"normalized_name\": \"astream\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://astream#bfb7d50e084d6d246ca9ff909c401aab30a6f9a6\",\n \"timestamp\": 1567524492,\n \"txid\": \"f3338742c2b4cf0e35b7ffa73aea3e9da786926cf82f07d3100e09d04ec3f231\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpmjego0ff\",\n \"sd_hash\": \"2ab7bbd96cb5db43df9ff909c0555dd8a132866355768c41d24f2b4be7c0478ae5f82d2c853e95c9b1179c6743e4bb37\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"value_type\": \"stream\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"mnjLVdEZcL1cPXoWntjbvkaPDPpYLTVdSJ\",\n \"amount\": \"0.999893\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 0,\n \"timestamp\": null,\n \"txid\": \"b2cba880bb6bb4fbf9c3acca5f9df6c3eee2ebf83df37688bf9a69e1876ffef0\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.000107\",\n \"total_input\": \"1.0\",\n \"total_output\": \"0.999893\",\n \"txid\": \"b2cba880bb6bb4fbf9c3acca5f9df6c3eee2ebf83df37688bf9a69e1876ffef0\"\n }\n}"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -2482,17 +2583,17 @@
|
||||
"examples": [
|
||||
{
|
||||
"title": "Create a stream claim without metadata",
|
||||
"curl": "curl -d'{\"method\": \"stream_create\", \"params\": {\"name\": \"astream\", \"bid\": \"1.0\", \"file_path\": \"/tmp/tmpwc0xotjc\", \"tags\": [], \"languages\": [], \"locations\": [], \"channel_account_id\": [], \"funding_account_ids\": [], \"preview\": false, \"blocking\": false}}' http://localhost:5279/",
|
||||
"lbrynet": "lbrynet stream create astream 1.0 /tmp/tmpwc0xotjc",
|
||||
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"stream_create\", \"params\": {\"name\": \"astream\", \"bid\": \"1.0\", \"file_path\": \"/tmp/tmpwc0xotjc\", \"tags\": [], \"languages\": [], \"locations\": [], \"channel_account_id\": [], \"funding_account_ids\": [], \"preview\": false, \"blocking\": false}}).json()",
|
||||
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"01000000012f35356c58ebfbce4884267d041a46b25318eda5a7d8155de2cb9fe53822ea81010000006b48304502210098a023fd71f8cb8a91b2251ac34b6c1c92da13426e28f2aeaf74283f2d3a79b60220752526ab6104fbf0d98adb25259f1a423f520ee60419388d52eff6a322e0bf97012102860c0ba9a89d394722e50d15c942a7c13c8a6cb6f24354f5d45f1debadb58bfbffffffff0200e1f50500000000bab5076173747265616d4c94000a90010a8d010a30fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd120b746d70776330786f746a63180b22186170706c69636174696f6e2f6f637465742d73747265616d3230ca7f2e83a2d275e25151463521e893b8812aa0b061ab299fb9877521c0a2ced15927eeca4f50680d8ea5e03ae6b6c3f26d7576a91415733e667eb7be1146f77b7eab0c5f757d623cc988ac38fb9423000000001976a914fb6300ecc589692a5f3befbac4da77c9fe698cd288ac00000000\",\n \"inputs\": [\n {\n \"address\": \"myg8y3kBaKVSyuUWSmgXN56iY5iyMBXza9\",\n \"amount\": \"6.983769\",\n \"confirmations\": 4,\n \"height\": 209,\n \"is_change\": true,\n \"is_mine\": true,\n \"nout\": 1,\n \"timestamp\": 1565587607,\n \"txid\": \"81ea2238e59fcbe25d15d8a7a5ed1853b2461a047d268448cefbeb586c35352f\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"mhUNYMksuH5HFj2DUG1DsLAtMMaup1cgqn\",\n \"amount\": \"1.0\",\n \"claim_id\": \"68fde0328b1a267b3815ce974a6329b159619092\",\n \"claim_op\": \"create\",\n \"confirmations\": -2,\n \"height\": -2,\n \"meta\": {},\n \"name\": \"astream\",\n \"normalized_name\": \"astream\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://astream#68fde0328b1a267b3815ce974a6329b159619092\",\n \"timestamp\": null,\n \"txid\": \"8585fd73e301e58e044581e3f4d2d1195a208e333e8632b75363da2f6ec55ab2\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpwc0xotjc\",\n \"sd_hash\": \"ca7f2e83a2d275e25151463521e893b8812aa0b061ab299fb9877521c0a2ced15927eeca4f50680d8ea5e03ae6b6c3f2\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"value_type\": \"stream\"\n },\n {\n \"address\": \"n4SAW6U5NeYRqQTdos4cLMgtbWRBFW8X16\",\n \"amount\": \"5.969662\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 1,\n \"timestamp\": null,\n \"txid\": \"8585fd73e301e58e044581e3f4d2d1195a208e333e8632b75363da2f6ec55ab2\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.014107\",\n \"total_input\": \"6.983769\",\n \"total_output\": \"6.969662\",\n \"txid\": \"8585fd73e301e58e044581e3f4d2d1195a208e333e8632b75363da2f6ec55ab2\"\n }\n}"
|
||||
"curl": "curl -d'{\"method\": \"stream_create\", \"params\": {\"name\": \"astream\", \"bid\": \"1.0\", \"file_path\": \"/tmp/tmpmjego0ff\", \"tags\": [], \"languages\": [], \"locations\": [], \"channel_account_id\": [], \"funding_account_ids\": [], \"preview\": false, \"blocking\": false}}' http://localhost:5279/",
|
||||
"lbrynet": "lbrynet stream create astream 1.0 /tmp/tmpmjego0ff",
|
||||
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"stream_create\", \"params\": {\"name\": \"astream\", \"bid\": \"1.0\", \"file_path\": \"/tmp/tmpmjego0ff\", \"tags\": [], \"languages\": [], \"locations\": [], \"channel_account_id\": [], \"funding_account_ids\": [], \"preview\": false, \"blocking\": false}}).json()",
|
||||
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"0100000001fa76b5ebe4e1dc0f511d6ee2d6ebc93576efc11ddbb0e6b31c17e1fa87590771010000006a47304402201470c22dd0eda9464317b03e19df649fdf3e714bd7ab7216786065cbcf7f506602204c1e906566d6470a6ec400b364970a07bc56f3c338929089966a6573a3b032a2012102cd305212f95664613654fae6a0b947c64fb741ab641b8ca731446f5301f8d2daffffffff0200e1f50500000000bab5076173747265616d4c94000a90010a8d010a30fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd120b746d706d6a65676f306666180b22186170706c69636174696f6e2f6f637465742d73747265616d32302ab7bbd96cb5db43df9ff909c0555dd8a132866355768c41d24f2b4be7c0478ae5f82d2c853e95c9b1179c6743e4bb376d7576a914726468487bd5cd1825dbe133ff4c1fee98694a1988ac38fb9423000000001976a9145f53c37fbba1d75a500cc3a95bd28d4ccf34894e88ac00000000\",\n \"inputs\": [\n {\n \"address\": \"mv5oQhBhKEBinD1Bs3MKmzznidZSGBN1FG\",\n \"amount\": \"6.983769\",\n \"confirmations\": 4,\n \"height\": 209,\n \"is_change\": true,\n \"is_mine\": true,\n \"nout\": 1,\n \"timestamp\": 1567524491,\n \"txid\": \"71075987fae1171cb3e6b0db1dc1ef7635c9ebd6e26e1d510fdce1e4ebb576fa\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"mqwocM9E8dcY9aHCaCGG6HXB8Pd3hA9KjF\",\n \"amount\": \"1.0\",\n \"claim_id\": \"bfb7d50e084d6d246ca9ff909c401aab30a6f9a6\",\n \"claim_op\": \"create\",\n \"confirmations\": -2,\n \"height\": -2,\n \"meta\": {},\n \"name\": \"astream\",\n \"normalized_name\": \"astream\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://astream#bfb7d50e084d6d246ca9ff909c401aab30a6f9a6\",\n \"timestamp\": null,\n \"txid\": \"16d37a20dd97fec3f8f86456ed6eee78547e7145c802afdf5c91418a6d99204a\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpmjego0ff\",\n \"sd_hash\": \"2ab7bbd96cb5db43df9ff909c0555dd8a132866355768c41d24f2b4be7c0478ae5f82d2c853e95c9b1179c6743e4bb37\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"value_type\": \"stream\"\n },\n {\n \"address\": \"mpCzqHAmHsyhp3J1NFWGPof1PoYhVugGdg\",\n \"amount\": \"5.969662\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 1,\n \"timestamp\": null,\n \"txid\": \"16d37a20dd97fec3f8f86456ed6eee78547e7145c802afdf5c91418a6d99204a\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.014107\",\n \"total_input\": \"6.983769\",\n \"total_output\": \"6.969662\",\n \"txid\": \"16d37a20dd97fec3f8f86456ed6eee78547e7145c802afdf5c91418a6d99204a\"\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/tmpnkt_49bq.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\": 1565587584, \"channel_id\": \"cbf954c2782b7cf571f7aa1de960202057618727\", \"channel_account_id\": [], \"funding_account_ids\": [], \"preview\": false, \"blocking\": false}}' http://localhost:5279/",
|
||||
"lbrynet": "lbrynet stream create blank-image 1.0 /tmp/tmpnkt_49bq.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=1565587584 --channel_id=\"cbf954c2782b7cf571f7aa1de960202057618727\"",
|
||||
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"stream_create\", \"params\": {\"name\": \"blank-image\", \"bid\": \"1.0\", \"file_path\": \"/tmp/tmpnkt_49bq.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\": 1565587584, \"channel_id\": \"cbf954c2782b7cf571f7aa1de960202057618727\", \"channel_account_id\": [], \"funding_account_ids\": [], \"preview\": false, \"blocking\": false}}).json()",
|
||||
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"0100000001b25ac56e2fda6353b732863e338e205a19d1d2f4e38145048ee501e373fd8585010000006a4730440220205c1cea74188145c8d3200ef2914b5852c8a3b151876c9d9431e9b52e82b3e0022061169e87088e2fd0759d457d0a444a9445d404b64358d5cbac08c5ab950dca6c012103ebc2c0ec16d9e24b5ebcb4bf957ddc9fd7a80376d1cff0d79f5d65e381d7fe42ffffffff0200e1f50500000000fddc01b50b626c616e6b2d696d6167654db1010127876157202060e91daaf771f57c2b78c254f9cb24eda15eb1995dfe4ea874fa93396c62e1fe82612e6b9b786ea0c55166e98e7880da5e3b48ef29ab4d1a9c83f71482c22a4acad548c27a5f5643550d0434f3b00ae6010a82010a306c7df435d412c603390f593ef658c199817c7830ba3f16b7eadd8f99fa50e85dbd0d2b3dc61eadc33fe096e3872d1545120f746d706e6b745f343962712e706e6718632209696d6167652f706e673230eda7090b2d59beb0d77de489961cb73bbc73bbbb80d2c3c0e5f547b8c07dc0eded9627ce12872ca86a20a51d54ae3c4b120650696361736f1a0d5075626c696320446f6d61696e2218687474703a2f2f7075626c69632d646f6d61696e2e6f72672880f1c3ea053222080112196f147b27d1c70b5fb7ff1560d32bfda68507a89a0f214e74e0188087a70e520408051007420b426c616e6b20496d6167654a184120626c616e6b20504e472074686174206973203578372e52252a23687474703a2f2f736d616c6c6d656469612e636f6d2f7468756d626e61696c2e6a70675a05626c616e6b5a03617274620208016a1308ec0112024e481a0a4d616e636865737465726d7576a914147b27d1c70b5fb7ff1560d32bfda68507a89a0f88acac5e7d1d000000001976a914d7d23f1f17bdd156052ea8c496a95070157fb6ab88ac00000000\",\n \"inputs\": [\n {\n \"address\": \"n4SAW6U5NeYRqQTdos4cLMgtbWRBFW8X16\",\n \"amount\": \"5.969662\",\n \"confirmations\": 2,\n \"height\": 213,\n \"is_change\": true,\n \"is_mine\": true,\n \"nout\": 1,\n \"timestamp\": 1565587608,\n \"txid\": \"8585fd73e301e58e044581e3f4d2d1195a208e333e8632b75363da2f6ec55ab2\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"mhPFLtT7YzmNfMuQYr4PQXAJdtaTKWRLFy\",\n \"amount\": \"1.0\",\n \"claim_id\": \"5cfb92c3e6a80aedee5282c3f64b565bc6965562\",\n \"claim_op\": \"create\",\n \"confirmations\": -2,\n \"height\": -2,\n \"is_channel_signature_valid\": true,\n \"meta\": {},\n \"name\": \"blank-image\",\n \"normalized_name\": \"blank-image\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://blank-image#5cfb92c3e6a80aedee5282c3f64b565bc6965562\",\n \"signing_channel\": {\n \"address\": \"mvE3pR2rH5mP1Hx8UEipnPt3Atp89tXqVw\",\n \"amount\": \"1.0\",\n \"claim_id\": \"cbf954c2782b7cf571f7aa1de960202057618727\",\n \"claim_op\": \"update\",\n \"confirmations\": 5,\n \"height\": 210,\n \"is_change\": false,\n \"is_mine\": true,\n \"meta\": {},\n \"name\": \"@channel\",\n \"normalized_name\": \"@channel\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://@channel#cbf954c2782b7cf571f7aa1de960202057618727\",\n \"timestamp\": 1565587607,\n \"txid\": \"794fc94e7ac645d5fc06c14e5ac9be9d9afa53cd540a349ee276662b23e21396\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a0342000404b644588c6a32f425fa8c2c3b0404898c79d405d1e90783adcf9a2bdbad505012f1e6be38f7837b69d5f2a1a1959135701780f01fc91c396158c4b1b9b1e304\",\n \"public_key_id\": \"mrPWGtFam2wwv7D1QRgXXrXePLqUGdKaCb\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n },\n \"timestamp\": null,\n \"txid\": \"474e26f1aceebbdbbbad02afd37dd39aa3eb221098fa8a4073b1117264422e98\",\n \"type\": \"claim\",\n \"value\": {\n \"author\": \"Picaso\",\n \"description\": \"A blank PNG that is 5x7.\",\n \"fee\": {\n \"address\": \"mhPFLtT7YzmNfMuQYr4PQXAJdtaTKWRLFy\",\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\": \"1565587584\",\n \"source\": {\n \"hash\": \"6c7df435d412c603390f593ef658c199817c7830ba3f16b7eadd8f99fa50e85dbd0d2b3dc61eadc33fe096e3872d1545\",\n \"media_type\": \"image/png\",\n \"name\": \"tmpnkt_49bq.png\",\n \"sd_hash\": \"eda7090b2d59beb0d77de489961cb73bbc73bbbb80d2c3c0e5f547b8c07dc0eded9627ce12872ca86a20a51d54ae3c4b\",\n \"size\": \"99\"\n },\n \"stream_type\": \"image\",\n \"tagsLine truncated
|
||||
"curl": "curl -d'{\"method\": \"stream_create\", \"params\": {\"name\": \"blank-image\", \"bid\": \"1.0\", \"file_path\": \"/tmp/tmpg_6t0r6a.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\": 1567524468, \"channel_id\": \"1812d3275894f62a055d59189a75698a071108af\", \"channel_account_id\": [], \"funding_account_ids\": [], \"preview\": false, \"blocking\": false}}' http://localhost:5279/",
|
||||
"lbrynet": "lbrynet stream create blank-image 1.0 /tmp/tmpg_6t0r6a.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=1567524468 --channel_id=\"1812d3275894f62a055d59189a75698a071108af\"",
|
||||
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"stream_create\", \"params\": {\"name\": \"blank-image\", \"bid\": \"1.0\", \"file_path\": \"/tmp/tmpg_6t0r6a.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\": 1567524468, \"channel_id\": \"1812d3275894f62a055d59189a75698a071108af\", \"channel_account_id\": [], \"funding_account_ids\": [], \"preview\": false, \"blocking\": false}}).json()",
|
||||
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"01000000014a20996d8a41915cdfaf02c845717e5478ee6eed5664f8f8c3fe97dd207ad316010000006b483045022100f808f427a2644e1b0bfdaaabb9dab4774b741a1033030b53ca8d19e2376e0af402205ff5c862bbbeda9cede5e42e1e13f48059325cea04f700817d725c11df91db8f012102ddf444347dfb68dc2f69ca9462ecfe0d30f1db4c10080bdcf696cb22de42ed25ffffffff0200e1f50500000000fddc01b50b626c616e6b2d696d6167654db10101af0811078a69759a18595d052af6945827d312183830ab666b25817d8432e95af7bb26baed712eeca26420f81c8f8255ca008c86dbb6c771a21cbc97d0f460f7b4d4243e40a26d66f77c615f0f9cb4f99a228a830ae6010a82010a306c7df435d412c603390f593ef658c199817c7830ba3f16b7eadd8f99fa50e85dbd0d2b3dc61eadc33fe096e3872d1545120f746d70675f3674307236612e706e6718632209696d6167652f706e673230019de60de1c0e860ae907dfbf13cd4a618a1acb9fb107e09bcaee3a6a7b2165a2a91e740a0fc9d4a4e613a6ed496bc33120650696361736f1a0d5075626c696320446f6d61696e2218687474703a2f2f7075626c69632d646f6d61696e2e6f726728f48cbaeb053222080112196ff97ffe7af1a8d072313edc64a91a58bebcc96496d7b1fc76188087a70e520408051007420b426c616e6b20496d6167654a184120626c616e6b20504e472074686174206973203578372e52252a23687474703a2f2f736d616c6c6d656469612e636f6d2f7468756d626e61696c2e6a70675a05626c616e6b5a03617274620208016a1308ec0112024e481a0a4d616e636865737465726d7576a914f97ffe7af1a8d072313edc64a91a58bebcc9649688acac5e7d1d000000001976a914325ef76f0613598d31a4952b241c4ad04e5452d688ac00000000\",\n \"inputs\": [\n {\n \"address\": \"mpCzqHAmHsyhp3J1NFWGPof1PoYhVugGdg\",\n \"amount\": \"5.969662\",\n \"confirmations\": 2,\n \"height\": 213,\n \"is_change\": true,\n \"is_mine\": true,\n \"nout\": 1,\n \"timestamp\": 1567524492,\n \"txid\": \"16d37a20dd97fec3f8f86456ed6eee78547e7145c802afdf5c91418a6d99204a\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"n4GBt198ctM4KF1AJGJG8ppxAeFyXFfut9\",\n \"amount\": \"1.0\",\n \"claim_id\": \"0e08f286e3e5cf0b17d3fa64da93fbf96b0e9c90\",\n \"claim_op\": \"create\",\n \"confirmations\": -2,\n \"height\": -2,\n \"is_channel_signature_valid\": true,\n \"meta\": {},\n \"name\": \"blank-image\",\n \"normalized_name\": \"blank-image\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://blank-image#0e08f286e3e5cf0b17d3fa64da93fbf96b0e9c90\",\n \"signing_channel\": {\n \"address\": \"mw6SpJDWJeYTWsr2iEFNEbRuqmNhDjpsZS\",\n \"amount\": \"1.0\",\n \"claim_id\": \"1812d3275894f62a055d59189a75698a071108af\",\n \"claim_op\": \"update\",\n \"confirmations\": 5,\n \"height\": 210,\n \"is_change\": false,\n \"is_mine\": true,\n \"meta\": {},\n \"name\": \"@channel\",\n \"normalized_name\": \"@channel\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://@channel#1812d3275894f62a055d59189a75698a071108af\",\n \"timestamp\": 1567524491,\n \"txid\": \"986dbf145a5320fe0047b3404216ddae76bb9e915895ebb04dda9c4e1b676be7\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a034200044974cd9d7098183f8bc9005f3957a4dbfc1ede19044311337fe9f645f256a7a4013c6a142497590bd8461fc50ce6b489453686422079c334bd5f8316b335365e\",\n \"public_key_id\": \"mrne5J4YN1SYYE3qNAAwzEVHAxnZX4AKHp\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n },\n \"timestamp\": null,\n \"txid\": \"55d87be458bd1a9aa960dd914b7f5c6d1b118d65d8b04477f705716d33091530\",\n \"type\": \"claim\",\n \"value\": {\n \"author\": \"Picaso\",\n \"description\": \"A blank PNG that is 5x7.\",\n \"fee\": {\n \"address\": \"n4GBt198ctM4KF1AJGJG8ppxAeFyXFfut9\",\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\": \"1567524468\",\n \"source\": {\n \"hash\": \"6c7df435d412c603390f593ef658c199817c7830ba3f16b7eadd8f99fa50e85dbd0d2b3dc61eadc33fe096e3872d1545\",\n \"media_type\": \"image/png\",\n \"name\": \"tmpg_6t0r6a.png\",\n \"sd_hash\": \"019de60de1c0e860ae907dfbf13cd4a618a1acb9fb107e09bcaee3a6a7b2165a2a91e740a0fc9d4a4e613a6ed496bc33\",\n \"size\": \"99\"\n },\n \"stream_type\": \"image\",\n \"taLine truncated
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -2526,14 +2627,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\": \"mhUNYMksuH5HFj2DUG1DsLAtMMaup1cgqn\",\n \"amount\": \"1.0\",\n \"claim_id\": \"68fde0328b1a267b3815ce974a6329b159619092\",\n \"claim_op\": \"update\",\n \"confirmations\": 1,\n \"height\": 214,\n \"is_change\": false,\n \"is_channel_signature_valid\": true,\n \"is_mine\": true,\n \"meta\": {},\n \"name\": \"astream\",\n \"normalized_name\": \"astream\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://astream#68fde0328b1a267b3815ce974a6329b159619092\",\n \"signing_channel\": {\n \"address\": \"mvE3pR2rH5mP1Hx8UEipnPt3Atp89tXqVw\",\n \"amount\": \"1.0\",\n \"claim_id\": \"cbf954c2782b7cf571f7aa1de960202057618727\",\n \"claim_op\": \"update\",\n \"confirmations\": 5,\n \"height\": 210,\n \"is_change\": false,\n \"is_mine\": true,\n \"meta\": {},\n \"name\": \"@channel\",\n \"normalized_name\": \"@channel\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://@channel#cbf954c2782b7cf571f7aa1de960202057618727\",\n \"timestamp\": 1565587607,\n \"txid\": \"794fc94e7ac645d5fc06c14e5ac9be9d9afa53cd540a349ee276662b23e21396\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a0342000404b644588c6a32f425fa8c2c3b0404898c79d405d1e90783adcf9a2bdbad505012f1e6be38f7837b69d5f2a1a1959135701780f01fc91c396158c4b1b9b1e304\",\n \"public_key_id\": \"mrPWGtFam2wwv7D1QRgXXrXePLqUGdKaCb\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n },\n \"timestamp\": 1565587608,\n \"txid\": \"55a247d733323e8645656c1c817ac34411fafb5493f9c528091897b6ca0e5400\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpwc0xotjc\",\n \"sd_hash\": \"ca7f2e83a2d275e25151463521e893b8812aa0b061ab299fb9877521c0a2ced15927eeca4f50680d8ea5e03ae6b6c3f2\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"value_type\": \"stream\"\n }\n ]\n}"
|
||||
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": [\n {\n \"address\": \"mqwocM9E8dcY9aHCaCGG6HXB8Pd3hA9KjF\",\n \"amount\": \"1.0\",\n \"claim_id\": \"bfb7d50e084d6d246ca9ff909c401aab30a6f9a6\",\n \"claim_op\": \"update\",\n \"confirmations\": 1,\n \"height\": 214,\n \"is_change\": false,\n \"is_channel_signature_valid\": true,\n \"is_mine\": true,\n \"meta\": {},\n \"name\": \"astream\",\n \"normalized_name\": \"astream\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://astream#bfb7d50e084d6d246ca9ff909c401aab30a6f9a6\",\n \"signing_channel\": {\n \"address\": \"mw6SpJDWJeYTWsr2iEFNEbRuqmNhDjpsZS\",\n \"amount\": \"1.0\",\n \"claim_id\": \"1812d3275894f62a055d59189a75698a071108af\",\n \"claim_op\": \"update\",\n \"confirmations\": 5,\n \"height\": 210,\n \"is_change\": false,\n \"is_mine\": true,\n \"meta\": {},\n \"name\": \"@channel\",\n \"normalized_name\": \"@channel\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://@channel#1812d3275894f62a055d59189a75698a071108af\",\n \"timestamp\": 1567524491,\n \"txid\": \"986dbf145a5320fe0047b3404216ddae76bb9e915895ebb04dda9c4e1b676be7\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a034200044974cd9d7098183f8bc9005f3957a4dbfc1ede19044311337fe9f645f256a7a4013c6a142497590bd8461fc50ce6b489453686422079c334bd5f8316b335365e\",\n \"public_key_id\": \"mrne5J4YN1SYYE3qNAAwzEVHAxnZX4AKHp\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n },\n \"timestamp\": 1567524492,\n \"txid\": \"f3338742c2b4cf0e35b7ffa73aea3e9da786926cf82f07d3100e09d04ec3f231\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpmjego0ff\",\n \"sd_hash\": \"2ab7bbd96cb5db43df9ff909c0555dd8a132866355768c41d24f2b4be7c0478ae5f82d2c853e95c9b1179c6743e4bb37\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"value_type\": \"stream\"\n }\n ]\n}"
|
||||
},
|
||||
{
|
||||
"title": "Paginate your stream claims",
|
||||
"curl": "curl -d'{\"method\": \"stream_list\", \"params\": {\"page\": 1, \"page_size\": 20}}' http://localhost:5279/",
|
||||
"lbrynet": "lbrynet stream list --page=1 --page_size=20",
|
||||
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"stream_list\", \"params\": {\"page\": 1, \"page_size\": 20}}).json()",
|
||||
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"items\": [\n {\n \"address\": \"mhUNYMksuH5HFj2DUG1DsLAtMMaup1cgqn\",\n \"amount\": \"1.0\",\n \"claim_id\": \"68fde0328b1a267b3815ce974a6329b159619092\",\n \"claim_op\": \"update\",\n \"confirmations\": 1,\n \"height\": 214,\n \"is_change\": false,\n \"is_channel_signature_valid\": true,\n \"is_mine\": true,\n \"meta\": {},\n \"name\": \"astream\",\n \"normalized_name\": \"astream\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://astream#68fde0328b1a267b3815ce974a6329b159619092\",\n \"signing_channel\": {\n \"address\": \"mvE3pR2rH5mP1Hx8UEipnPt3Atp89tXqVw\",\n \"amount\": \"1.0\",\n \"claim_id\": \"cbf954c2782b7cf571f7aa1de960202057618727\",\n \"claim_op\": \"update\",\n \"confirmations\": 5,\n \"height\": 210,\n \"is_change\": false,\n \"is_mine\": true,\n \"meta\": {},\n \"name\": \"@channel\",\n \"normalized_name\": \"@channel\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://@channel#cbf954c2782b7cf571f7aa1de960202057618727\",\n \"timestamp\": 1565587607,\n \"txid\": \"794fc94e7ac645d5fc06c14e5ac9be9d9afa53cd540a349ee276662b23e21396\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a0342000404b644588c6a32f425fa8c2c3b0404898c79d405d1e90783adcf9a2bdbad505012f1e6be38f7837b69d5f2a1a1959135701780f01fc91c396158c4b1b9b1e304\",\n \"public_key_id\": \"mrPWGtFam2wwv7D1QRgXXrXePLqUGdKaCb\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n },\n \"timestamp\": 1565587608,\n \"txid\": \"55a247d733323e8645656c1c817ac34411fafb5493f9c528091897b6ca0e5400\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpwc0xotjc\",\n \"sd_hash\": \"ca7f2e83a2d275e25151463521e893b8812aa0b061ab299fb9877521c0a2ced15927eeca4f50680d8ea5e03ae6b6c3f2\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"value_type\": \"stream\"\n }\n ],\n \"page\": 1,\n \"page_size\": 20,\n \"total_items\": 1,\n \"total_pages\": 1\n }\n}"
|
||||
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"items\": [\n {\n \"address\": \"mqwocM9E8dcY9aHCaCGG6HXB8Pd3hA9KjF\",\n \"amount\": \"1.0\",\n \"claim_id\": \"bfb7d50e084d6d246ca9ff909c401aab30a6f9a6\",\n \"claim_op\": \"update\",\n \"confirmations\": 1,\n \"height\": 214,\n \"is_change\": false,\n \"is_channel_signature_valid\": true,\n \"is_mine\": true,\n \"meta\": {},\n \"name\": \"astream\",\n \"normalized_name\": \"astream\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://astream#bfb7d50e084d6d246ca9ff909c401aab30a6f9a6\",\n \"signing_channel\": {\n \"address\": \"mw6SpJDWJeYTWsr2iEFNEbRuqmNhDjpsZS\",\n \"amount\": \"1.0\",\n \"claim_id\": \"1812d3275894f62a055d59189a75698a071108af\",\n \"claim_op\": \"update\",\n \"confirmations\": 5,\n \"height\": 210,\n \"is_change\": false,\n \"is_mine\": true,\n \"meta\": {},\n \"name\": \"@channel\",\n \"normalized_name\": \"@channel\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://@channel#1812d3275894f62a055d59189a75698a071108af\",\n \"timestamp\": 1567524491,\n \"txid\": \"986dbf145a5320fe0047b3404216ddae76bb9e915895ebb04dda9c4e1b676be7\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a034200044974cd9d7098183f8bc9005f3957a4dbfc1ede19044311337fe9f645f256a7a4013c6a142497590bd8461fc50ce6b489453686422079c334bd5f8316b335365e\",\n \"public_key_id\": \"mrne5J4YN1SYYE3qNAAwzEVHAxnZX4AKHp\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n },\n \"timestamp\": 1567524492,\n \"txid\": \"f3338742c2b4cf0e35b7ffa73aea3e9da786926cf82f07d3100e09d04ec3f231\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpmjego0ff\",\n \"sd_hash\": \"2ab7bbd96cb5db43df9ff909c0555dd8a132866355768c41d24f2b4be7c0478ae5f82d2c853e95c9b1179c6743e4bb37\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"value_type\": \"stream\"\n }\n ],\n \"page\": 1,\n \"page_size\": 20,\n \"total_items\": 1,\n \"total_pages\": 1\n }\n}"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -2762,10 +2863,10 @@
|
||||
"examples": [
|
||||
{
|
||||
"title": "Update a stream claim to add channel",
|
||||
"curl": "curl -d'{\"method\": \"stream_update\", \"params\": {\"claim_id\": \"68fde0328b1a267b3815ce974a6329b159619092\", \"clear_fee\": false, \"tags\": [], \"clear_tags\": false, \"languages\": [], \"clear_languages\": false, \"locations\": [], \"clear_locations\": false, \"channel_id\": \"cbf954c2782b7cf571f7aa1de960202057618727\", \"clear_channel\": false, \"channel_account_id\": [], \"funding_account_ids\": [], \"preview\": false, \"blocking\": false, \"replace\": false}}' http://localhost:5279/",
|
||||
"lbrynet": "lbrynet stream update 68fde0328b1a267b3815ce974a6329b159619092 --channel_id=\"cbf954c2782b7cf571f7aa1de960202057618727\"",
|
||||
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"stream_update\", \"params\": {\"claim_id\": \"68fde0328b1a267b3815ce974a6329b159619092\", \"clear_fee\": false, \"tags\": [], \"clear_tags\": false, \"languages\": [], \"clear_languages\": false, \"locations\": [], \"clear_locations\": false, \"channel_id\": \"cbf954c2782b7cf571f7aa1de960202057618727\", \"clear_channel\": false, \"channel_account_id\": [], \"funding_account_ids\": [], \"preview\": false, \"blocking\": false, \"replace\": false}}).json()",
|
||||
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"0100000002b25ac56e2fda6353b732863e338e205a19d1d2f4e38145048ee501e373fd8585000000006a47304402204716abc5afb3bb9479264b8ef8e682afd4d755cc26222aaa6dd4ae5dbc038782022078b7ee55cd5fceaa9051041da83e70ba5a2a775d627d114cf9ca6c2c72ea39be012102e5f31d1a080e94c45195eb667ca7224c90d6f2351de3c0f069189adbe7dda5d9ffffffffe3f8863fb8521183a9f80b9c190b42ca7f26ef269f23962617be746aa7ff111a010000006a47304402204f7b48231ad7c9c88ba4af87e920c792e165c3f3ddcd464c1f7c8999adf01c66022054e274c1378fff338e3dfd147a34a4c769fcfd5ad0fcbb280fafc62c85ebe502012102cf036fe173b3b49a4c8ef6eef8539aa53000002a3d0cab29aa6fbe4a066f0b78ffffffff0200e1f50500000000fd2301b7076173747265616d1492906159b129634a97ce15387b261a8b32e0fd684ce80127876157202060e91daaf771f57c2b78c254f9cb399c380097dccb958b0a22cddccfb1ff04aa93fa4022c09f2063b86e67ed1b5bc8546dfec3d1faf5c2c75c365722f78c508ba288b1f0cb3913fd391ff1796a1c0a90010a8d010a30fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd120b746d70776330786f746a63180b22186170706c69636174696f6e2f6f637465742d73747265616d3230ca7f2e83a2d275e25151463521e893b8812aa0b061ab299fb9877521c0a2ced15927eeca4f50680d8ea5e03ae6b6c3f26d6d76a91415733e667eb7be1146f77b7eab0c5f757d623cc988ac32a0d205000000001976a9149feb153831e4799de0cf2933a4884c5ff7baa53a88ac00000000\",\n \"inputs\": [\n {\n \"address\": \"mhUNYMksuH5HFj2DUG1DsLAtMMaup1cgqn\",\n \"amount\": \"1.0\",\n \"claim_id\": \"68fde0328b1a267b3815ce974a6329b159619092\",\n \"claim_op\": \"create\",\n \"confirmations\": 1,\n \"height\": 213,\n \"is_change\": false,\n \"is_mine\": true,\n \"meta\": {},\n \"name\": \"astream\",\n \"normalized_name\": \"astream\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://astream#68fde0328b1a267b3815ce974a6329b159619092\",\n \"timestamp\": 1565587608,\n \"txid\": \"8585fd73e301e58e044581e3f4d2d1195a208e333e8632b75363da2f6ec55ab2\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpwc0xotjc\",\n \"sd_hash\": \"ca7f2e83a2d275e25151463521e893b8812aa0b061ab299fb9877521c0a2ced15927eeca4f50680d8ea5e03ae6b6c3f2\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"value_type\": \"stream\"\n },\n {\n \"address\": \"mzHFAQfgBr1QpQr8YSMpJFg54vkhwU2WoB\",\n \"amount\": \"0.9772285\",\n \"confirmations\": 3,\n \"height\": 211,\n \"is_change\": true,\n \"is_mine\": true,\n \"nout\": 1,\n \"timestamp\": 1565587607,\n \"txid\": \"1a11ffa76a74be172696239f26ef267fca420b199c0bf8a9831152b83f86f8e3\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"mhUNYMksuH5HFj2DUG1DsLAtMMaup1cgqn\",\n \"amount\": \"1.0\",\n \"claim_id\": \"68fde0328b1a267b3815ce974a6329b159619092\",\n \"claim_op\": \"update\",\n \"confirmations\": -2,\n \"height\": -2,\n \"is_channel_signature_valid\": true,\n \"meta\": {},\n \"name\": \"astream\",\n \"normalized_name\": \"astream\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://astream#68fde0328b1a267b3815ce974a6329b159619092\",\n \"signing_channel\": {\n \"address\": \"mvE3pR2rH5mP1Hx8UEipnPt3Atp89tXqVw\",\n \"amount\": \"1.0\",\n \"claim_id\": \"cbf954c2782b7cf571f7aa1de960202057618727\",\n \"claim_op\": \"update\",\n \"confirmations\": 4,\n \"height\": 210,\n \"is_change\": false,\n \"is_mine\": true,\n \"meta\": {},\n \"name\": \"@channel\",\n \"normalized_name\": \"@channel\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://@channel#cbf954c2782b7cf571f7aa1de960202057618727\",\n \"timestamp\": 1565587607,\n \"txid\": \"794fc94e7ac645d5fc06c14e5ac9be9d9afa53cd540a349ee276662b23e21396\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a0342000404b644588c6a32f425fa8c2c3b0404898c79d405d1e90783adcf9a2bdbad505012f1e6be38f7837b69d5f2a1a1959135701780f01fc91c396158c4b1b9b1e304\",\n \"public_key_id\": \"mrPWGtFam2wwv7D1QRgXXrXePLqUGdKaCb\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n },\n \"timestamp\": null,\n \"txid\": \"55a247d733323e8645656c1c817ac34411fafb5493f9c528091897b6ca0e5400\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040Line truncated
|
||||
"curl": "curl -d'{\"method\": \"stream_update\", \"params\": {\"claim_id\": \"bfb7d50e084d6d246ca9ff909c401aab30a6f9a6\", \"clear_fee\": false, \"tags\": [], \"clear_tags\": false, \"languages\": [], \"clear_languages\": false, \"locations\": [], \"clear_locations\": false, \"channel_id\": \"1812d3275894f62a055d59189a75698a071108af\", \"clear_channel\": false, \"channel_account_id\": [], \"funding_account_ids\": [], \"preview\": false, \"blocking\": false, \"replace\": false}}' http://localhost:5279/",
|
||||
"lbrynet": "lbrynet stream update bfb7d50e084d6d246ca9ff909c401aab30a6f9a6 --channel_id=\"1812d3275894f62a055d59189a75698a071108af\"",
|
||||
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"stream_update\", \"params\": {\"claim_id\": \"bfb7d50e084d6d246ca9ff909c401aab30a6f9a6\", \"clear_fee\": false, \"tags\": [], \"clear_tags\": false, \"languages\": [], \"clear_languages\": false, \"locations\": [], \"clear_locations\": false, \"channel_id\": \"1812d3275894f62a055d59189a75698a071108af\", \"clear_channel\": false, \"channel_account_id\": [], \"funding_account_ids\": [], \"preview\": false, \"blocking\": false, \"replace\": false}}).json()",
|
||||
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"01000000024a20996d8a41915cdfaf02c845717e5478ee6eed5664f8f8c3fe97dd207ad316000000006b4830450221009c4970496e636abc34224449e1f1d622371f01b147049da7f6f6f3bcb67baa2802200b3287b5a1c69d5ef2c2e3e7b7e9b380e9b8f4ab98432bb2af3f9ac4669d96690121023b0815369b8ef78200d00b1fef7fdd6bf0dac1a84cb34756aa390e54e07e85ecffffffffbded7fa7ca114b69dc8970c6a101c2f3025ece7ad98d45016b9506b99e79929b010000006a473044022013977e030d5d69106109c028565c3797bd4e38c6d3da87350ef2764a6dfa73be022050375628a5458937d7ad2d76acd4e405a75bf3fa5d99a8858417512e5c450697012102886cb9914841d8ba268858f82323ecab77a977d3cf5cf605a3bf0df8b70503e9ffffffff0200e1f50500000000fd2301b7076173747265616d14a6f9a630ab1a409c90ffa96c246d4d080ed5b7bf4ce801af0811078a69759a18595d052af6945827d31218a49f0b990dfb596d464fa5c166a752b4835b01f02dcabd712d4345b09c18ce4096395d25caf4fb962732f54d58df839f9dd7cc2ef1d4303c89e4dd553865ed060a90010a8d010a30fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd120b746d706d6a65676f306666180b22186170706c69636174696f6e2f6f637465742d73747265616d32302ab7bbd96cb5db43df9ff909c0555dd8a132866355768c41d24f2b4be7c0478ae5f82d2c853e95c9b1179c6743e4bb376d6d76a914726468487bd5cd1825dbe133ff4c1fee98694a1988ac32a0d205000000001976a914b7fb7f269d470a1f77e83285c02e2d07f5a83c0588ac00000000\",\n \"inputs\": [\n {\n \"address\": \"mqwocM9E8dcY9aHCaCGG6HXB8Pd3hA9KjF\",\n \"amount\": \"1.0\",\n \"claim_id\": \"bfb7d50e084d6d246ca9ff909c401aab30a6f9a6\",\n \"claim_op\": \"create\",\n \"confirmations\": 1,\n \"height\": 213,\n \"is_change\": false,\n \"is_mine\": true,\n \"meta\": {},\n \"name\": \"astream\",\n \"normalized_name\": \"astream\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://astream#bfb7d50e084d6d246ca9ff909c401aab30a6f9a6\",\n \"timestamp\": 1567524492,\n \"txid\": \"16d37a20dd97fec3f8f86456ed6eee78547e7145c802afdf5c91418a6d99204a\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpmjego0ff\",\n \"sd_hash\": \"2ab7bbd96cb5db43df9ff909c0555dd8a132866355768c41d24f2b4be7c0478ae5f82d2c853e95c9b1179c6743e4bb37\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"value_type\": \"stream\"\n },\n {\n \"address\": \"myHCXzM5bmTxED6Tyc9WcLhGsP1u8M9Wfo\",\n \"amount\": \"0.9772285\",\n \"confirmations\": 3,\n \"height\": 211,\n \"is_change\": true,\n \"is_mine\": true,\n \"nout\": 1,\n \"timestamp\": 1567524491,\n \"txid\": \"9b92799eb906956b01458dd97ace5e02f3c201a1c67089dc694b11caa77fedbd\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"mqwocM9E8dcY9aHCaCGG6HXB8Pd3hA9KjF\",\n \"amount\": \"1.0\",\n \"claim_id\": \"bfb7d50e084d6d246ca9ff909c401aab30a6f9a6\",\n \"claim_op\": \"update\",\n \"confirmations\": -2,\n \"height\": -2,\n \"is_channel_signature_valid\": true,\n \"meta\": {},\n \"name\": \"astream\",\n \"normalized_name\": \"astream\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://astream#bfb7d50e084d6d246ca9ff909c401aab30a6f9a6\",\n \"signing_channel\": {\n \"address\": \"mw6SpJDWJeYTWsr2iEFNEbRuqmNhDjpsZS\",\n \"amount\": \"1.0\",\n \"claim_id\": \"1812d3275894f62a055d59189a75698a071108af\",\n \"claim_op\": \"update\",\n \"confirmations\": 4,\n \"height\": 210,\n \"is_change\": false,\n \"is_mine\": true,\n \"meta\": {},\n \"name\": \"@channel\",\n \"normalized_name\": \"@channel\",\n \"nout\": 0,\n \"permanent_url\": \"lbry://@channel#1812d3275894f62a055d59189a75698a071108af\",\n \"timestamp\": 1567524491,\n \"txid\": \"986dbf145a5320fe0047b3404216ddae76bb9e915895ebb04dda9c4e1b676be7\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a034200044974cd9d7098183f8bc9005f3957a4dbfc1ede19044311337fe9f645f256a7a4013c6a142497590bd8461fc50ce6b489453686422079c334bd5f8316b335365e\",\n \"public_key_id\": \"mrne5J4YN1SYYE3qNAAwzEVHAxnZX4AKHp\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n },\n \"timestamp\": null,\n \"txid\": \"f3338742c2b4cf0e35b7ffa73aea3e9da786926cf82f07d3100e09d04ec3f231\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e0Line truncated
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -2781,7 +2882,7 @@
|
||||
{
|
||||
"name": "claim_id",
|
||||
"type": "str",
|
||||
"description": "claim_id of the claim to abandon",
|
||||
"description": "claim_id of the support to abandon",
|
||||
"is_required": false
|
||||
},
|
||||
{
|
||||
@@ -2973,7 +3074,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-08-12 01:26\",\n \"fee\": \"-0.000124\",\n \"support_info\": [],\n \"timestamp\": 1565587607,\n \"txid\": \"0295fc060686b1872040214dabead8a042edbcc3a00f79580c27777841f5c504\",\n \"update_info\": [],\n \"value\": \"0.0\"\n },\n {\n \"abandon_info\": [],\n \"claim_info\": [],\n \"confirmations\": 7,\n \"date\": \"2019-08-12 01:26\",\n \"fee\": \"0.0\",\n \"support_info\": [],\n \"timestamp\": 1565587606,\n \"txid\": \"c6ec4fd79fda21863a5a7825ced028fb606f890daf669ff8386061ef6e4ef8d5\",\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-09-03 11:28\",\n \"fee\": \"-0.000124\",\n \"support_info\": [],\n \"timestamp\": 1567524491,\n \"txid\": \"3e770eda0c2cc8b74e0107e6395fc686a08e022814f55a8153f83fb0f5f923ab\",\n \"update_info\": [],\n \"value\": \"0.0\"\n },\n {\n \"abandon_info\": [],\n \"claim_info\": [],\n \"confirmations\": 7,\n \"date\": \"2019-09-03 11:28\",\n \"fee\": \"0.0\",\n \"support_info\": [],\n \"timestamp\": 1567524490,\n \"txid\": \"79b42ae4b80e2fcc997251899b763a4d3666beea57db5cd7628dfd14ed08152d\",\n \"update_info\": [],\n \"value\": \"10.0\"\n }\n ]\n}"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
__name__ = "lbry"
|
||||
__version__ = "0.39.2"
|
||||
__version__ = "0.41.0"
|
||||
version = tuple(__version__.split('.'))
|
||||
|
||||
@@ -151,7 +151,7 @@ class BlobExchangeClientProtocol(asyncio.Protocol):
|
||||
return self._blob_bytes_received, self.close()
|
||||
msg = f"downloading {self.blob.blob_hash[:8]} from {self.peer_address}:{self.peer_port}," \
|
||||
f" timeout in {self.peer_timeout}"
|
||||
log.info(msg)
|
||||
log.debug(msg)
|
||||
msg = f"downloaded {self.blob.blob_hash[:8]} from {self.peer_address}:{self.peer_port}"
|
||||
await asyncio.wait_for(self.writer.finished, self.peer_timeout, loop=self.loop)
|
||||
log.info("%s at %fMB/s", msg,
|
||||
|
||||
+2
-3
@@ -377,12 +377,11 @@ class BaseConfig:
|
||||
|
||||
@contextmanager
|
||||
def update_config(self):
|
||||
if not isinstance(self.persisted, ConfigFileAccess):
|
||||
raise TypeError("Config file cannot be updated.")
|
||||
self._updating_config = True
|
||||
yield self
|
||||
self._updating_config = False
|
||||
self.persisted.save()
|
||||
if isinstance(self.persisted, ConfigFileAccess):
|
||||
self.persisted.save()
|
||||
|
||||
@property
|
||||
def modify_order(self):
|
||||
|
||||
@@ -22,13 +22,12 @@ class BlobAnnouncer:
|
||||
if peers > 4:
|
||||
return blob_hash
|
||||
else:
|
||||
log.warning("failed to announce %s, could only find %d peers, retrying soon.", blob_hash[:8], peers)
|
||||
log.debug("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))
|
||||
|
||||
|
||||
async def _announce(self, batch_size: typing.Optional[int] = 10):
|
||||
while batch_size:
|
||||
if not self.node.joined.is_set():
|
||||
|
||||
@@ -88,10 +88,10 @@ class Node:
|
||||
)
|
||||
stored_to = [node_id for node_id, contacted in stored_to_tup if contacted]
|
||||
if stored_to:
|
||||
log.info("Stored %s to %i of %i attempted peers", binascii.hexlify(hash_value).decode()[:8],
|
||||
log.debug("Stored %s to %i of %i attempted peers", binascii.hexlify(hash_value).decode()[:8],
|
||||
len(stored_to), len(peers))
|
||||
else:
|
||||
log.warning("Failed announcing %s, stored to 0 peers", blob_hash[:8])
|
||||
log.debug("Failed announcing %s, stored to 0 peers", blob_hash[:8])
|
||||
return stored_to
|
||||
|
||||
def stop(self) -> None:
|
||||
|
||||
@@ -218,6 +218,7 @@ class HeadersComponent(Component):
|
||||
await self.headers.close()
|
||||
else:
|
||||
log.info("Header checkpoint verified.")
|
||||
|
||||
async def stop(self):
|
||||
pass
|
||||
|
||||
@@ -239,14 +240,14 @@ class WalletComponent(Component):
|
||||
local_height = self.wallet_manager.ledger.headers.height
|
||||
remote_height = self.wallet_manager.ledger.network.remote_height
|
||||
best_hash = self.wallet_manager.get_best_blockhash()
|
||||
server = self.wallet_manager.ledger.network.client.server
|
||||
return {
|
||||
'connected_servers': [
|
||||
{
|
||||
'host': server[0],
|
||||
'port': server[1],
|
||||
'latency': 0 # TODO: use real latency
|
||||
}
|
||||
'host': session.server[0],
|
||||
'port': session.server[1],
|
||||
'latency': round(session.connection_latency, 2),
|
||||
} for session in self.wallet_manager.ledger.network.session_pool.sessions
|
||||
if session and session.available
|
||||
],
|
||||
'blocks': max(local_height, 0),
|
||||
'blocks_behind': max(remote_height - local_height, 0),
|
||||
|
||||
@@ -9,6 +9,7 @@ import base58
|
||||
import random
|
||||
import ecdsa
|
||||
import hashlib
|
||||
import tracemalloc
|
||||
from urllib.parse import urlencode, quote
|
||||
from typing import Callable, Optional, List
|
||||
from binascii import hexlify, unhexlify
|
||||
@@ -145,6 +146,14 @@ DHT_HAS_CONTACTS = "dht_has_contacts"
|
||||
WALLET_IS_UNLOCKED = "wallet_is_unlocked"
|
||||
|
||||
|
||||
def debug_log_tracemalloc():
|
||||
snapshot = tracemalloc.take_snapshot()
|
||||
top_stats = snapshot.statistics('lineno')
|
||||
log.debug("[ Top 10 memory usage ]")
|
||||
for stat in top_stats[:10]:
|
||||
log.debug(stat)
|
||||
|
||||
|
||||
class DHTHasContacts(RequiredCondition):
|
||||
name = DHT_HAS_CONTACTS
|
||||
component = DHT_COMPONENT
|
||||
@@ -392,6 +401,10 @@ class Daemon(metaclass=JSONRPCServerType):
|
||||
|
||||
async def update_connection_status(self):
|
||||
connected = await utils.async_check_connection()
|
||||
if connected and not self._connection_status[1]:
|
||||
log.info("detected internet connection is working")
|
||||
elif not connected and self._connection_status[1]:
|
||||
log.warning("detected internet connection was lost")
|
||||
self._connection_status = (self.component_manager.loop.time(), connected)
|
||||
|
||||
async def get_connection_status(self) -> str:
|
||||
@@ -791,6 +804,8 @@ class Daemon(metaclass=JSONRPCServerType):
|
||||
}
|
||||
}
|
||||
"""
|
||||
if tracemalloc.is_tracing():
|
||||
debug_log_tracemalloc()
|
||||
|
||||
connection_code = await self.get_connection_status()
|
||||
|
||||
@@ -1000,6 +1015,54 @@ class Daemon(metaclass=JSONRPCServerType):
|
||||
setattr(c, key, cleaned)
|
||||
return {key: cleaned}
|
||||
|
||||
PREFERENCE_DOC = """
|
||||
Preferences management.
|
||||
"""
|
||||
|
||||
def jsonrpc_preference_get(self, key=None, account_id=None):
|
||||
"""
|
||||
Get preference value for key or all values if not key is passed in.
|
||||
|
||||
Usage:
|
||||
preference_get [<key>]
|
||||
|
||||
Options:
|
||||
--key=<key> : (str) key associated with value
|
||||
--account_id=<account_id> : (str) id of the account containing value
|
||||
|
||||
Returns:
|
||||
(dict) Dictionary of preference(s)
|
||||
"""
|
||||
account = self.get_account_or_default(account_id)
|
||||
if key:
|
||||
if key in account.preferences:
|
||||
return {key: account.preferences[key]}
|
||||
return
|
||||
return account.preferences
|
||||
|
||||
def jsonrpc_preference_set(self, key, value, account_id=None):
|
||||
"""
|
||||
Set preferences
|
||||
|
||||
Usage:
|
||||
preference_set (<key>) (<value>)
|
||||
|
||||
Options:
|
||||
--key=<key> : (str) key associated with value
|
||||
--value=<key> : (str) key associated with value
|
||||
--account_id=<account_id> : (str) id of the account containing value
|
||||
|
||||
Returns:
|
||||
(dict) Dictionary with key/value of new preference
|
||||
"""
|
||||
account = self.get_account_or_default(account_id)
|
||||
if value and isinstance(value, str) and value[0] in ('[', '{'):
|
||||
value = json.loads(value)
|
||||
account.preferences[key] = value
|
||||
account.modified_on = time.time()
|
||||
self.default_wallet.save()
|
||||
return {key: value}
|
||||
|
||||
ACCOUNT_DOC = """
|
||||
Create, modify and inspect wallet accounts.
|
||||
"""
|
||||
@@ -2239,15 +2302,39 @@ class Daemon(metaclass=JSONRPCServerType):
|
||||
channel_private_key = ecdsa.SigningKey.from_pem(
|
||||
data['signing_private_key'], hashfunc=hashlib.sha256
|
||||
)
|
||||
account: LBCAccount = await self.ledger.get_account_for_address(data['holding_address'])
|
||||
if not account:
|
||||
account = LBCAccount.from_dict(self.ledger, self.default_wallet, {
|
||||
'name': f"Holding Account For Channel {data['name']}",
|
||||
'public_key': data['holding_public_key'],
|
||||
'address_generator': {'name': 'single-address'}
|
||||
})
|
||||
if self.ledger.network.is_connected:
|
||||
await self.ledger.subscribe_account(account)
|
||||
public_key_der = channel_private_key.get_verifying_key().to_der()
|
||||
|
||||
# check that the holding_address hasn't changed since the export was made
|
||||
holding_address = data['holding_address']
|
||||
channels, _, _ = await self.ledger.claim_search(
|
||||
public_key_id=self.ledger.public_key_to_address(public_key_der)
|
||||
)
|
||||
if channels and channels[0].get_address(self.ledger) != holding_address:
|
||||
holding_address = channels[0].get_address(self.ledger)
|
||||
|
||||
account: LBCAccount = await self.ledger.get_account_for_address(holding_address)
|
||||
if account:
|
||||
# Case 1: channel holding address is in one of the accounts we already have
|
||||
# simply add the certificate to existing account
|
||||
pass
|
||||
else:
|
||||
# Case 2: channel holding address hasn't changed and thus is in the bundled read-only account
|
||||
# create a single-address holding account to manage the channel
|
||||
if holding_address == data['holding_address']:
|
||||
account = LBCAccount.from_dict(self.ledger, self.default_wallet, {
|
||||
'name': f"Holding Account For Channel {data['name']}",
|
||||
'public_key': data['holding_public_key'],
|
||||
'address_generator': {'name': 'single-address'}
|
||||
})
|
||||
if self.ledger.network.is_connected:
|
||||
await self.ledger.subscribe_account(account)
|
||||
await self.ledger._update_tasks.done.wait()
|
||||
# Case 3: the holding address has changed and we can't create or find an account for it
|
||||
else:
|
||||
raise Exception(
|
||||
"Channel owning account has changed since the channel was exported and "
|
||||
"it is not an account to which you have access."
|
||||
)
|
||||
account.add_channel_private_key(channel_private_key)
|
||||
self.default_wallet.save()
|
||||
return f"Added channel signing key for {data['name']}."
|
||||
@@ -2893,7 +2980,7 @@ class Daemon(metaclass=JSONRPCServerType):
|
||||
[--account_id=<account_id>] [--preview] [--blocking]
|
||||
|
||||
Options:
|
||||
--claim_id=<claim_id> : (str) claim_id of the claim to abandon
|
||||
--claim_id=<claim_id> : (str) claim_id of the support to abandon
|
||||
--txid=<txid> : (str) txid of the claim to abandon
|
||||
--nout=<nout> : (int) nout of the claim to abandon
|
||||
--keep=<keep> : (decimal) amount of lbc to keep as support
|
||||
@@ -3420,7 +3507,8 @@ class Daemon(metaclass=JSONRPCServerType):
|
||||
|
||||
@requires(WALLET_COMPONENT)
|
||||
async def jsonrpc_comment_list(self, claim_id, parent_id=None, page=1, page_size=50,
|
||||
include_replies=True, is_channel_signature_valid=False):
|
||||
include_replies=True, is_channel_signature_valid=False,
|
||||
hidden=False, visible=False):
|
||||
"""
|
||||
List comments associated with a claim.
|
||||
|
||||
@@ -3429,6 +3517,7 @@ class Daemon(metaclass=JSONRPCServerType):
|
||||
[(--page=<page> --page_size=<page_size>)]
|
||||
[--parent_id=<parent_id>] [--include_replies]
|
||||
[--is_channel_signature_valid]
|
||||
[--visible | --hidden]
|
||||
|
||||
Options:
|
||||
--claim_id=<claim_id> : (str) The claim on which the comment will be made on
|
||||
@@ -3439,6 +3528,8 @@ class Daemon(metaclass=JSONRPCServerType):
|
||||
--is_channel_signature_valid : (bool) Only include comments with valid signatures.
|
||||
[Warning: Paginated total size will not change, even
|
||||
if list reduces]
|
||||
--visible : (bool) Select only Visisble Comments
|
||||
--hidden : (bool) Select only Hidden Comments
|
||||
|
||||
Returns:
|
||||
(dict) Containing the list, and information about the paginated content:
|
||||
@@ -3463,15 +3554,25 @@ class Daemon(metaclass=JSONRPCServerType):
|
||||
]
|
||||
}
|
||||
"""
|
||||
result = await comment_client.jsonrpc_post(
|
||||
self.conf.comment_server,
|
||||
"get_claim_comments",
|
||||
claim_id=claim_id,
|
||||
parent_id=parent_id,
|
||||
page=page,
|
||||
page_size=page_size,
|
||||
top_level=not include_replies
|
||||
)
|
||||
if hidden ^ visible:
|
||||
result = await comment_client.jsonrpc_post(
|
||||
self.conf.comment_server,
|
||||
'get_claim_hidden_comments',
|
||||
claim_id=claim_id,
|
||||
hidden=hidden,
|
||||
page=page,
|
||||
page_size=page_size
|
||||
)
|
||||
else:
|
||||
result = await comment_client.jsonrpc_post(
|
||||
self.conf.comment_server,
|
||||
'get_claim_comments',
|
||||
claim_id=claim_id,
|
||||
parent_id=parent_id,
|
||||
page=page,
|
||||
page_size=page_size,
|
||||
top_level=not include_replies
|
||||
)
|
||||
for comment in result.get('items', []):
|
||||
channel_url = comment.get('channel_url')
|
||||
if not channel_url:
|
||||
@@ -3550,13 +3651,13 @@ class Daemon(metaclass=JSONRPCServerType):
|
||||
comment_abandon (<comment_id> | --comment_id=<comment_id>)
|
||||
|
||||
Options:
|
||||
--comment_id=<comment_id> : (str) The ID of the comment to be deleted.
|
||||
--comment_id=<comment_id> : (str) The ID of the comment to be abandoned.
|
||||
|
||||
Returns:
|
||||
(dict) Object with the `comment_id` passed in as the key, and a flag indicating if it was deleted
|
||||
(dict) Object with the `comment_id` passed in as the key, and a flag indicating if it was abandoned
|
||||
{
|
||||
<comment_id> (str): {
|
||||
"deleted": (bool)
|
||||
"abandoned": (bool)
|
||||
}
|
||||
}
|
||||
"""
|
||||
@@ -3565,14 +3666,54 @@ class Daemon(metaclass=JSONRPCServerType):
|
||||
self.conf.comment_server, 'get_channel_from_comment_id', comment_id=comment_id
|
||||
)
|
||||
if 'error' in channel:
|
||||
return {comment_id: {'deleted': False}}
|
||||
return {comment_id: {'abandoned': False}}
|
||||
channel = await self.get_channel_or_none(None, **channel)
|
||||
abandon_comment_body.update({
|
||||
'channel_id': channel.claim_id,
|
||||
'channel_name': channel.claim_name,
|
||||
})
|
||||
comment_client.sign_comment(abandon_comment_body, channel, abandon=True)
|
||||
return await comment_client.jsonrpc_post(self.conf.comment_server, 'delete_comment', abandon_comment_body)
|
||||
return await comment_client.jsonrpc_post(self.conf.comment_server, 'abandon_comment', abandon_comment_body)
|
||||
|
||||
@requires(WALLET_COMPONENT)
|
||||
async def jsonrpc_comment_hide(self, comment_ids: typing.Union[str, list]):
|
||||
"""
|
||||
Hide a comment published to a claim you control.
|
||||
|
||||
Usage:
|
||||
comment_hide <comment_ids>...
|
||||
|
||||
Options:
|
||||
--comment_ids=<comment_ids> : (str, list) one or more comment_id to hide.
|
||||
|
||||
Returns:
|
||||
(dict) keyed by comment_id, containing success info
|
||||
'<comment_id>': {
|
||||
"hidden": (bool) flag indicating if comment_id was hidden
|
||||
}
|
||||
"""
|
||||
if isinstance(comment_ids, str):
|
||||
comment_ids = [comment_ids]
|
||||
|
||||
comments = await comment_client.jsonrpc_post(
|
||||
self.conf.comment_server, 'get_comments_by_id', comment_ids=comment_ids
|
||||
)
|
||||
claim_ids = {comment['claim_id'] for comment in comments}
|
||||
claims = {cid: await self.ledger.get_claim_by_claim_id(claim_id=cid) for cid in claim_ids}
|
||||
pieces = []
|
||||
for comment in comments:
|
||||
claim = claims.get(comment['claim_id'])
|
||||
if claim:
|
||||
channel = await self.get_channel_or_none(
|
||||
account_ids=[],
|
||||
channel_id=claim.channel.claim_id,
|
||||
channel_name=claim.channel.claim_name,
|
||||
for_signing=True
|
||||
)
|
||||
piece = {'comment_id': comment['comment_id']}
|
||||
comment_client.sign_comment(piece, channel, abandon=True)
|
||||
pieces.append(piece)
|
||||
return await comment_client.jsonrpc_post(self.conf.comment_server, 'hide_comments', pieces=pieces)
|
||||
|
||||
async def broadcast_or_release(self, tx, blocking=False):
|
||||
try:
|
||||
@@ -3593,18 +3734,14 @@ class Daemon(metaclass=JSONRPCServerType):
|
||||
def valid_stream_name_or_error(name: str):
|
||||
try:
|
||||
if not name:
|
||||
raise Exception(
|
||||
"Stream name cannot be blank."
|
||||
)
|
||||
raise Exception('Stream name cannot be blank.')
|
||||
parsed = URL.parse(name)
|
||||
if parsed.has_channel:
|
||||
raise Exception(
|
||||
"Stream names cannot start with '@' symbol. This is reserved for channels claims."
|
||||
)
|
||||
if not parsed.has_stream or parsed.stream.name != name:
|
||||
raise Exception(
|
||||
"Stream name has invalid characters."
|
||||
)
|
||||
raise Exception('Stream name has invalid characters.')
|
||||
except (TypeError, ValueError):
|
||||
raise Exception("Invalid stream name.")
|
||||
|
||||
@@ -3649,17 +3786,19 @@ class Daemon(metaclass=JSONRPCServerType):
|
||||
key, value = 'name', channel_name
|
||||
else:
|
||||
raise ValueError("Couldn't find channel because a channel_id or channel_name was not provided.")
|
||||
for account in self.get_accounts_or_all(account_ids):
|
||||
channels = await account.get_channels(**{f'claim_{key}': value}, limit=1)
|
||||
if len(channels) == 1:
|
||||
if for_signing and channels[0].private_key is None:
|
||||
raise Exception(f"Couldn't find private key for {key} '{value}'. ")
|
||||
return channels[0]
|
||||
elif len(channels) > 1:
|
||||
raise ValueError(
|
||||
f"Multiple channels found with channel_{key} '{value}', "
|
||||
f"pass a channel_id to narrow it down."
|
||||
)
|
||||
channels = await self.ledger.get_channels(
|
||||
accounts=self.get_accounts_or_all(account_ids),
|
||||
**{f'claim_{key}': value}
|
||||
)
|
||||
if len(channels) == 1:
|
||||
if for_signing and not channels[0].has_private_key:
|
||||
raise Exception(f"Couldn't find private key for {key} '{value}'. ")
|
||||
return channels[0]
|
||||
elif len(channels) > 1:
|
||||
raise ValueError(
|
||||
f"Multiple channels found with channel_{key} '{value}', "
|
||||
f"pass a channel_id to narrow it down."
|
||||
)
|
||||
raise ValueError(f"Couldn't find channel with channel_{key} '{value}'.")
|
||||
|
||||
def get_account_or_default(self, account_id: str, argument_name: str = "account", lbc_only=True) -> LBCAccount:
|
||||
|
||||
@@ -57,8 +57,7 @@ async def jsonrpc_post(url: str, method: str, params: dict = None, **kwargs) ->
|
||||
params = params or {}
|
||||
params.update(kwargs)
|
||||
json_body = {'jsonrpc': '2.0', 'id': None, 'method': method, 'params': params}
|
||||
headers = {'Content-Type': 'application/json'}
|
||||
async with utils.aiohttp_request('POST', url, json=json_body, headers=headers) as response:
|
||||
async with utils.aiohttp_request('POST', url, json=json_body) as response:
|
||||
try:
|
||||
result = await response.json()
|
||||
return result['result'] if 'result' in result else result
|
||||
|
||||
@@ -3,7 +3,8 @@ import time
|
||||
import logging
|
||||
import json
|
||||
from decimal import Decimal
|
||||
|
||||
from typing import Optional
|
||||
from aiohttp.client_exceptions import ClientError
|
||||
from lbry.error import InvalidExchangeRateResponse, CurrencyConversionError
|
||||
from lbry.utils import aiohttp_request
|
||||
|
||||
@@ -44,7 +45,7 @@ class MarketFeed:
|
||||
self.params = params
|
||||
self.fee = fee
|
||||
self.rate = None
|
||||
self._task: asyncio.Task = None
|
||||
self._task: Optional[asyncio.Task] = None
|
||||
self._online = True
|
||||
|
||||
def rate_is_initialized(self):
|
||||
@@ -80,7 +81,7 @@ class MarketFeed:
|
||||
try:
|
||||
response = await asyncio.wait_for(self._make_request(), self.REQUESTS_TIMEOUT)
|
||||
self._save_price(self._subtract_fee(self._handle_response(response)))
|
||||
except (asyncio.TimeoutError, InvalidExchangeRateResponse) as err:
|
||||
except (asyncio.TimeoutError, InvalidExchangeRateResponse, ClientError) as err:
|
||||
self._on_error(err)
|
||||
await asyncio.sleep(self.EXCHANGE_RATE_UPDATE_RATE_SEC)
|
||||
|
||||
|
||||
@@ -148,7 +148,7 @@ class JSONResponseEncoder(JSONEncoder):
|
||||
'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,
|
||||
'timestamp': self.ledger.headers[tx_height]['timestamp'] if tx_height > 0 else None
|
||||
'timestamp': self.ledger.headers[tx_height]['timestamp'] if 0 < tx_height <= best_height else None
|
||||
}
|
||||
if txo.is_change is not None:
|
||||
output['is_change'] = txo.is_change
|
||||
@@ -172,7 +172,7 @@ class JSONResponseEncoder(JSONEncoder):
|
||||
'normalized_name': txo.normalized_name,
|
||||
'claim_id': txo.claim_id,
|
||||
'permanent_url': txo.permanent_url,
|
||||
'meta': self.encode_claim_meta(txo.meta)
|
||||
'meta': self.encode_claim_meta(txo.meta.copy())
|
||||
})
|
||||
if 'short_url' in output['meta']:
|
||||
output['short_url'] = output['meta'].pop('short_url')
|
||||
@@ -184,6 +184,8 @@ class JSONResponseEncoder(JSONEncoder):
|
||||
output['value_type'] = txo.claim.claim_type
|
||||
if self.include_protobuf:
|
||||
output['protobuf'] = hexlify(txo.claim.to_bytes())
|
||||
if txo.claim.is_channel:
|
||||
output['has_signing_key'] = txo.has_private_key
|
||||
if check_signature and txo.claim.is_signed:
|
||||
if txo.channel is not None:
|
||||
output['signing_channel'] = self.encode_output(txo.channel)
|
||||
@@ -200,7 +202,7 @@ class JSONResponseEncoder(JSONEncoder):
|
||||
if key.endswith('_amount'):
|
||||
if isinstance(value, int):
|
||||
meta[key] = dewies_to_lbc(value)
|
||||
if meta.get('creation_height', 0) > 0:
|
||||
if 0 < meta.get('creation_height', 0) <= self.ledger.headers.height:
|
||||
meta['creation_timestamp'] = self.ledger.headers[meta['creation_height']]['timestamp']
|
||||
return meta
|
||||
|
||||
@@ -218,15 +220,44 @@ class JSONResponseEncoder(JSONEncoder):
|
||||
return result
|
||||
|
||||
def encode_file(self, managed_stream):
|
||||
file = managed_stream.as_dict()
|
||||
output_exists = managed_stream.output_file_exists
|
||||
tx_height = managed_stream.stream_claim_info.height
|
||||
best_height = self.ledger.headers.height
|
||||
file.update({
|
||||
return {
|
||||
'streaming_url': managed_stream.stream_url,
|
||||
'completed': managed_stream.completed,
|
||||
'file_name': managed_stream.file_name if output_exists else None,
|
||||
'download_directory': managed_stream.download_directory if output_exists else None,
|
||||
'download_path': managed_stream.full_path if output_exists else None,
|
||||
'points_paid': 0.0,
|
||||
'stopped': not managed_stream.running,
|
||||
'stream_hash': managed_stream.stream_hash,
|
||||
'stream_name': managed_stream.descriptor.stream_name,
|
||||
'suggested_file_name': managed_stream.descriptor.suggested_file_name,
|
||||
'sd_hash': managed_stream.descriptor.sd_hash,
|
||||
'mime_type': managed_stream.mime_type,
|
||||
'key': managed_stream.descriptor.key,
|
||||
'total_bytes_lower_bound': managed_stream.descriptor.lower_bound_decrypted_length(),
|
||||
'total_bytes': managed_stream.descriptor.upper_bound_decrypted_length(),
|
||||
'written_bytes': managed_stream.written_bytes,
|
||||
'blobs_completed': managed_stream.blobs_completed,
|
||||
'blobs_in_stream': managed_stream.blobs_in_stream,
|
||||
'blobs_remaining': managed_stream.blobs_remaining,
|
||||
'status': managed_stream.status,
|
||||
'claim_id': managed_stream.claim_id,
|
||||
'txid': managed_stream.txid,
|
||||
'nout': managed_stream.nout,
|
||||
'outpoint': managed_stream.outpoint,
|
||||
'metadata': managed_stream.metadata,
|
||||
'protobuf': managed_stream.metadata_protobuf,
|
||||
'channel_claim_id': managed_stream.channel_claim_id,
|
||||
'channel_name': managed_stream.channel_name,
|
||||
'claim_name': managed_stream.claim_name,
|
||||
'content_fee': managed_stream.content_fee,
|
||||
'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
|
||||
'confirmations': (best_height + 1) - tx_height if tx_height > 0 else tx_height,
|
||||
'timestamp': self.ledger.headers[tx_height]['timestamp'] if 0 < tx_height <= best_height else None
|
||||
}
|
||||
|
||||
def encode_claim(self, claim):
|
||||
encoded = getattr(claim, claim.claim_type).to_dict()
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import asyncio
|
||||
from aiohttp.client_exceptions import ClientError
|
||||
import json
|
||||
import logging.handlers
|
||||
import traceback
|
||||
@@ -49,9 +50,12 @@ class HTTPSLogglyHandler(logging.Handler):
|
||||
return record.getMessage()
|
||||
|
||||
async def _emit(self, record):
|
||||
payload = self.format(record)
|
||||
async with utils.aiohttp_request('post', self.url, data=payload.encode(), cookies=self.cookies) as response:
|
||||
self.cookies.update(response.cookies)
|
||||
try:
|
||||
async with utils.aiohttp_request('post', self.url, data=self.format(record).encode(),
|
||||
cookies=self.cookies) as response:
|
||||
self.cookies.update(response.cookies)
|
||||
except ClientError:
|
||||
pass
|
||||
|
||||
def emit(self, record):
|
||||
asyncio.ensure_future(self._emit(record))
|
||||
|
||||
@@ -90,20 +90,6 @@ def get_claims_from_stream_hashes(transaction: sqlite3.Connection,
|
||||
}
|
||||
|
||||
|
||||
def get_content_claim_from_outpoint(transaction: sqlite3.Connection,
|
||||
outpoint: str) -> typing.Optional[StoredStreamClaim]:
|
||||
query = (
|
||||
"select content_claim.stream_hash, c.*, case when c.channel_claim_id is not null then "
|
||||
" (select claim_name from claim where claim_id==c.channel_claim_id) "
|
||||
" else null end as channel_name "
|
||||
" from content_claim "
|
||||
" inner join claim c on c.claim_outpoint=content_claim.claim_outpoint and content_claim.claim_outpoint=?"
|
||||
)
|
||||
claim_fields = transaction.execute(query, (outpoint, )).fetchone()
|
||||
if claim_fields:
|
||||
return StoredStreamClaim(*claim_fields)
|
||||
|
||||
|
||||
def _batched_select(transaction, query, parameters, batch_size=900):
|
||||
for start_index in range(0, len(parameters), batch_size):
|
||||
current_batch = parameters[start_index:start_index+batch_size]
|
||||
@@ -325,31 +311,6 @@ class SQLiteStorage(SQLiteMixin):
|
||||
"select status from blob where blob_hash=?", blob_hash
|
||||
)
|
||||
|
||||
def should_announce(self, blob_hash: str):
|
||||
return self.run_and_return_one_or_none(
|
||||
"select should_announce from blob where blob_hash=?", blob_hash
|
||||
)
|
||||
|
||||
def count_should_announce_blobs(self):
|
||||
return self.run_and_return_one_or_none(
|
||||
"select count(*) from blob where should_announce=1 and status='finished'"
|
||||
)
|
||||
|
||||
def get_all_should_announce_blobs(self):
|
||||
return self.run_and_return_list(
|
||||
"select blob_hash from blob where should_announce=1 and status='finished'"
|
||||
)
|
||||
|
||||
def get_all_finished_blobs(self):
|
||||
return self.run_and_return_list(
|
||||
"select blob_hash from blob where status='finished'"
|
||||
)
|
||||
|
||||
def count_finished_blobs(self):
|
||||
return self.run_and_return_one_or_none(
|
||||
"select count(*) from blob where status='finished'"
|
||||
)
|
||||
|
||||
def update_last_announced_blobs(self, blob_hashes: typing.List[str]):
|
||||
def _update_last_announced_blobs(transaction: sqlite3.Connection):
|
||||
last_announced = self.time_getter()
|
||||
@@ -427,26 +388,6 @@ class SQLiteStorage(SQLiteMixin):
|
||||
}
|
||||
return self.db.run(_sync_blobs)
|
||||
|
||||
def sync_files_to_blobs(self):
|
||||
def _sync_blobs(transaction: sqlite3.Connection):
|
||||
transaction.executemany(
|
||||
"update file set status='stopped' where stream_hash=?",
|
||||
transaction.execute(
|
||||
"select distinct sb.stream_hash from stream_blob sb "
|
||||
"inner join blob b on b.blob_hash=sb.blob_hash and b.status=='pending'"
|
||||
).fetchall()
|
||||
)
|
||||
return self.db.run(_sync_blobs)
|
||||
|
||||
def set_files_as_streaming(self, stream_hashes: typing.List[str]):
|
||||
def _set_streaming(transaction: sqlite3.Connection):
|
||||
transaction.executemany(
|
||||
"update file set file_name=null, download_directory=null where stream_hash=?",
|
||||
[(stream_hash, ) for stream_hash in stream_hashes]
|
||||
)
|
||||
|
||||
return self.db.run(_set_streaming)
|
||||
|
||||
# # # # # # # # # stream functions # # # # # # # # #
|
||||
|
||||
async def stream_exists(self, sd_hash: str) -> bool:
|
||||
@@ -459,11 +400,6 @@ class SQLiteStorage(SQLiteMixin):
|
||||
"s.stream_hash=f.stream_hash and s.sd_hash=?", sd_hash)
|
||||
return streams is not None
|
||||
|
||||
def rowid_for_stream(self, stream_hash: str) -> typing.Awaitable[typing.Optional[int]]:
|
||||
return self.run_and_return_one_or_none(
|
||||
"select rowid from file where stream_hash=?", stream_hash
|
||||
)
|
||||
|
||||
def store_stream(self, sd_blob: 'BlobFile', descriptor: 'StreamDescriptor'):
|
||||
return self.db.run(store_stream, sd_blob, descriptor)
|
||||
|
||||
@@ -509,12 +445,6 @@ class SQLiteStorage(SQLiteMixin):
|
||||
"select stream_hash from stream where sd_hash = ?", sd_blob_hash
|
||||
)
|
||||
|
||||
def get_stream_info_for_sd_hash(self, sd_blob_hash):
|
||||
return self.run_and_return_one_or_none(
|
||||
"select stream_hash, stream_name, suggested_filename, stream_key from stream where sd_hash = ?",
|
||||
sd_blob_hash
|
||||
)
|
||||
|
||||
def delete_stream(self, descriptor: 'StreamDescriptor'):
|
||||
return self.db.run_with_foreign_keys_disabled(delete_stream, descriptor)
|
||||
|
||||
@@ -788,55 +718,6 @@ class SQLiteStorage(SQLiteMixin):
|
||||
claim['effective_amount'] = calculate_effective_amount(claim['amount'], supports)
|
||||
return claim
|
||||
|
||||
async def get_claims_from_stream_hashes(self, stream_hashes: typing.List[str],
|
||||
include_supports: typing.Optional[bool] = True):
|
||||
claims = await self.db.run(get_claims_from_stream_hashes, stream_hashes)
|
||||
return {stream_hash: claim_info.as_dict() for stream_hash, claim_info in claims.items()}
|
||||
|
||||
async def get_claim(self, claim_outpoint, include_supports=True):
|
||||
claim_info = await self.db.run(get_content_claim_from_outpoint, claim_outpoint)
|
||||
if not claim_info:
|
||||
return
|
||||
result = claim_info.as_dict()
|
||||
if include_supports:
|
||||
supports = await self.get_supports(result['claim_id'])
|
||||
result['supports'] = supports
|
||||
result['effective_amount'] = calculate_effective_amount(result['amount'], supports)
|
||||
return result
|
||||
|
||||
def get_unknown_certificate_ids(self):
|
||||
def _get_unknown_certificate_claim_ids(transaction):
|
||||
return [
|
||||
claim_id for (claim_id,) in transaction.execute(
|
||||
"select distinct c1.channel_claim_id from claim as c1 "
|
||||
"where c1.channel_claim_id!='' "
|
||||
"and c1.channel_claim_id not in "
|
||||
"(select c2.claim_id from claim as c2)"
|
||||
).fetchall()
|
||||
]
|
||||
return self.db.run(_get_unknown_certificate_claim_ids)
|
||||
|
||||
async def get_pending_claim_outpoints(self):
|
||||
claim_outpoints = await self.run_and_return_list("select claim_outpoint from claim where height=-1")
|
||||
results = {} # {txid: [nout, ...]}
|
||||
for outpoint_str in claim_outpoints:
|
||||
txid, nout = outpoint_str.split(":")
|
||||
outputs = results.get(txid, [])
|
||||
outputs.append(int(nout))
|
||||
results[txid] = outputs
|
||||
if results:
|
||||
log.debug("missing transaction heights for %i claims", len(results))
|
||||
return results
|
||||
|
||||
def save_claim_tx_heights(self, claim_tx_heights):
|
||||
def _save_claim_heights(transaction):
|
||||
for outpoint, height in claim_tx_heights.items():
|
||||
transaction.execute(
|
||||
"update claim set height=? where claim_outpoint=? and height=-1",
|
||||
(height, outpoint)
|
||||
)
|
||||
return self.db.run(_save_claim_heights)
|
||||
|
||||
# # # # # # # # # reflector functions # # # # # # # # #
|
||||
|
||||
def update_reflected_stream(self, sd_hash, reflector_address, success=True):
|
||||
|
||||
@@ -123,6 +123,14 @@ class ManagedStream:
|
||||
def written_bytes(self) -> int:
|
||||
return 0 if not self.output_file_exists else os.stat(self.full_path).st_size
|
||||
|
||||
@property
|
||||
def completed(self):
|
||||
return self.written_bytes >= self.descriptor.lower_bound_decrypted_length()
|
||||
|
||||
@property
|
||||
def stream_url(self):
|
||||
return f"http://{self.config.streaming_host}:{self.config.streaming_port}/stream/{self.sd_hash}"
|
||||
|
||||
async def update_status(self, status: str):
|
||||
assert status in [self.STATUS_RUNNING, self.STATUS_STOPPED, self.STATUS_FINISHED]
|
||||
self._status = status
|
||||
@@ -203,47 +211,6 @@ class ManagedStream:
|
||||
def mime_type(self):
|
||||
return guess_media_type(os.path.basename(self.descriptor.suggested_file_name))[0]
|
||||
|
||||
def as_dict(self) -> typing.Dict:
|
||||
full_path = self.full_path
|
||||
file_name = self.file_name
|
||||
download_directory = self.download_directory
|
||||
if not self.output_file_exists:
|
||||
full_path = None
|
||||
file_name = None
|
||||
download_directory = None
|
||||
return {
|
||||
'streaming_url': f"http://{self.config.streaming_host}:{self.config.streaming_port}/stream/{self.sd_hash}",
|
||||
'completed': self.written_bytes >= self.descriptor.lower_bound_decrypted_length(),
|
||||
'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': full_path,
|
||||
'mime_type': self.mime_type,
|
||||
'key': self.descriptor.key,
|
||||
'total_bytes_lower_bound': self.descriptor.lower_bound_decrypted_length(),
|
||||
'total_bytes': self.descriptor.upper_bound_decrypted_length(),
|
||||
'written_bytes': self.written_bytes,
|
||||
'blobs_completed': self.blobs_completed,
|
||||
'blobs_in_stream': self.blobs_in_stream,
|
||||
'blobs_remaining': self.blobs_remaining,
|
||||
'status': self.status,
|
||||
'claim_id': self.claim_id,
|
||||
'txid': self.txid,
|
||||
'nout': self.nout,
|
||||
'outpoint': self.outpoint,
|
||||
'metadata': self.metadata,
|
||||
'protobuf': self.metadata_protobuf,
|
||||
'channel_claim_id': self.channel_claim_id,
|
||||
'channel_name': self.channel_name,
|
||||
'claim_name': self.claim_name,
|
||||
'content_fee': self.content_fee
|
||||
}
|
||||
|
||||
@classmethod
|
||||
async def create(cls, loop: asyncio.AbstractEventLoop, config: 'Config', blob_manager: 'BlobManager',
|
||||
file_path: str, key: typing.Optional[bytes] = None,
|
||||
|
||||
+5
-11
@@ -81,28 +81,22 @@ def check_connection(server="lbry.com", port=80, timeout=5) -> bool:
|
||||
try:
|
||||
server = socket.gethostbyname(server)
|
||||
socket.create_connection((server, port), timeout).close()
|
||||
log.debug('Connection successful')
|
||||
return True
|
||||
except (socket.gaierror, socket.herror) as ex:
|
||||
log.warning("Failed to connect to %s:%s. Unable to resolve domain. Trying to bypass DNS",
|
||||
server, port)
|
||||
log.debug("Failed to connect to %s:%s. Unable to resolve domain. Trying to bypass DNS",
|
||||
server, port)
|
||||
try:
|
||||
server = "8.8.8.8"
|
||||
port = 53
|
||||
socket.create_connection((server, port), timeout).close()
|
||||
log.debug('Connection successful')
|
||||
return True
|
||||
except Exception:
|
||||
log.error("Failed to connect to %s:%s. Maybe the internet connection is not working",
|
||||
server, port)
|
||||
except OSError:
|
||||
return False
|
||||
except Exception:
|
||||
log.error("Failed to connect to %s:%s. Maybe the internet connection is not working",
|
||||
server, port)
|
||||
except OSError:
|
||||
return False
|
||||
|
||||
|
||||
async def async_check_connection(server="lbry.com", port=80, timeout=5) -> bool:
|
||||
async def async_check_connection(server="lbry.com", port=80, timeout=1) -> bool:
|
||||
return await asyncio.get_event_loop().run_in_executor(None, check_connection, server, port, timeout)
|
||||
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ from string import hexdigits
|
||||
|
||||
import ecdsa
|
||||
from lbry.wallet.dewies import dewies_to_lbc
|
||||
from lbry.wallet.constants import TXO_TYPES
|
||||
|
||||
from torba.client.baseaccount import BaseAccount, HierarchicalDeterministic
|
||||
|
||||
@@ -27,6 +28,7 @@ class Account(BaseAccount):
|
||||
def __init__(self, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
self.channel_keys = {}
|
||||
self.preferences = {}
|
||||
|
||||
@property
|
||||
def hash(self) -> bytes:
|
||||
@@ -38,6 +40,7 @@ class Account(BaseAccount):
|
||||
def apply(self, d: dict):
|
||||
super().apply(d)
|
||||
self.channel_keys.update(d.get('certificates', {}))
|
||||
self.preferences.update(d.get('preferences', {}))
|
||||
|
||||
def add_channel_private_key(self, private_key):
|
||||
public_key_bytes = private_key.get_verifying_key().to_der()
|
||||
@@ -74,7 +77,7 @@ class Account(BaseAccount):
|
||||
|
||||
def get_balance(self, confirmations=0, include_claims=False, **constraints):
|
||||
if not include_claims:
|
||||
constraints.update({'is_claim': 0, 'is_update': 0, 'is_support': 0})
|
||||
constraints.update({'txo_type': 0})
|
||||
return super().get_balance(confirmations, **constraints)
|
||||
|
||||
async def get_granular_balances(self, confirmations=0, reserved_subtotals=False):
|
||||
@@ -82,7 +85,7 @@ class Account(BaseAccount):
|
||||
get_total_balance = partial(self.get_balance, confirmations=confirmations, include_claims=True)
|
||||
total = await get_total_balance()
|
||||
if reserved_subtotals:
|
||||
claims_balance = await get_total_balance(claim_type__or={'is_claim': True, 'is_update': True})
|
||||
claims_balance = await get_total_balance(txo_type__in=[TXO_TYPES['stream'], TXO_TYPES['channel']])
|
||||
for amount, spent, from_me, to_me, height in await self.get_support_summary():
|
||||
if confirmations > 0 and not 0 < height <= self.ledger.headers.height - (confirmations - 1):
|
||||
continue
|
||||
@@ -94,8 +97,7 @@ class Account(BaseAccount):
|
||||
reserved = claims_balance + supports_balance + tips_balance
|
||||
else:
|
||||
reserved = await self.get_balance(
|
||||
confirmations=confirmations, include_claims=True,
|
||||
claim_type__or={'is_claim': True, 'is_support': True, 'is_update': True}
|
||||
confirmations=confirmations, include_claims=True, txo_type__gt=0
|
||||
)
|
||||
return {
|
||||
'total': dewies_to_lbc(total),
|
||||
@@ -118,17 +120,22 @@ class Account(BaseAccount):
|
||||
def from_dict(cls, ledger, wallet, d: dict) -> 'Account':
|
||||
account = super().from_dict(ledger, wallet, d)
|
||||
account.channel_keys = d.get('certificates', {})
|
||||
account.preferences = d.get('preferences', {})
|
||||
return account
|
||||
|
||||
def to_dict(self, include_channel_keys=True):
|
||||
def to_dict(self, include_channel_keys=True, include_preferences=True):
|
||||
d = super().to_dict()
|
||||
if include_channel_keys:
|
||||
d['certificates'] = self.channel_keys
|
||||
if include_preferences and self.preferences:
|
||||
d['preferences'] = self.preferences
|
||||
return d
|
||||
|
||||
async def get_details(self, **kwargs):
|
||||
details = await super().get_details(**kwargs)
|
||||
details['certificates'] = len(self.channel_keys)
|
||||
if self.preferences:
|
||||
details['preferences'] = self.preferences
|
||||
return details
|
||||
|
||||
def get_transaction_history(self, **constraints):
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
TXO_TYPES = {
|
||||
"stream": 1,
|
||||
"channel": 2,
|
||||
"support": 3
|
||||
}
|
||||
@@ -3,6 +3,7 @@ from typing import List
|
||||
from torba.client.basedatabase import BaseDatabase
|
||||
|
||||
from lbry.wallet.transaction import Output
|
||||
from lbry.wallet.constants import TXO_TYPES
|
||||
|
||||
|
||||
class WalletDatabase(BaseDatabase):
|
||||
@@ -17,15 +18,12 @@ class WalletDatabase(BaseDatabase):
|
||||
script blob not null,
|
||||
is_reserved boolean not null default 0,
|
||||
|
||||
txo_type integer not null default 0,
|
||||
claim_id text,
|
||||
claim_name text,
|
||||
is_claim boolean not null default 0,
|
||||
is_update boolean not null default 0,
|
||||
is_support boolean not null default 0,
|
||||
is_buy boolean not null default 0,
|
||||
is_sell boolean not null default 0
|
||||
claim_name text
|
||||
);
|
||||
create index if not exists txo_claim_id_idx on txo (claim_id);
|
||||
create index if not exists txo_txo_type_idx on txo (txo_type);
|
||||
"""
|
||||
|
||||
CREATE_TABLES_QUERY = (
|
||||
@@ -40,13 +38,13 @@ class WalletDatabase(BaseDatabase):
|
||||
|
||||
def txo_to_row(self, tx, address, txo):
|
||||
row = super().txo_to_row(tx, address, txo)
|
||||
row.update({
|
||||
'is_claim': txo.script.is_claim_name,
|
||||
'is_update': txo.script.is_update_claim,
|
||||
'is_support': txo.script.is_support_claim,
|
||||
'is_buy': txo.script.is_buy_claim,
|
||||
'is_sell': txo.script.is_sell_claim,
|
||||
})
|
||||
if txo.is_claim:
|
||||
if txo.can_decode_claim:
|
||||
row['txo_type'] = TXO_TYPES.get(txo.claim.claim_type, TXO_TYPES['stream'])
|
||||
else:
|
||||
row['txo_type'] = TXO_TYPES['stream']
|
||||
elif txo.is_support:
|
||||
row['txo_type'] = TXO_TYPES['support']
|
||||
if txo.script.is_claim_involved:
|
||||
row['claim_id'] = txo.claim_id
|
||||
row['claim_name'] = txo.claim_name
|
||||
@@ -87,7 +85,9 @@ class WalletDatabase(BaseDatabase):
|
||||
|
||||
@staticmethod
|
||||
def constrain_claims(constraints):
|
||||
constraints['claim_type__any'] = {'is_claim': 1, 'is_update': 1}
|
||||
constraints['txo_type__in'] = [
|
||||
TXO_TYPES['stream'], TXO_TYPES['channel']
|
||||
]
|
||||
|
||||
async def get_claims(self, **constraints) -> List[Output]:
|
||||
self.constrain_claims(constraints)
|
||||
@@ -99,8 +99,7 @@ class WalletDatabase(BaseDatabase):
|
||||
|
||||
@staticmethod
|
||||
def constrain_streams(constraints):
|
||||
if 'claim_name' not in constraints or 'claim_id' not in constraints:
|
||||
constraints['claim_name__not_like'] = '@%'
|
||||
constraints['txo_type'] = TXO_TYPES['stream']
|
||||
|
||||
def get_streams(self, **constraints):
|
||||
self.constrain_streams(constraints)
|
||||
@@ -112,8 +111,7 @@ class WalletDatabase(BaseDatabase):
|
||||
|
||||
@staticmethod
|
||||
def constrain_channels(constraints):
|
||||
if 'claim_name' not in constraints or 'claim_id' not in constraints:
|
||||
constraints['claim_name__like'] = '@%'
|
||||
constraints['txo_type'] = TXO_TYPES['channel']
|
||||
|
||||
def get_channels(self, **constraints):
|
||||
self.constrain_channels(constraints)
|
||||
@@ -125,7 +123,7 @@ class WalletDatabase(BaseDatabase):
|
||||
|
||||
@staticmethod
|
||||
def constrain_supports(constraints):
|
||||
constraints['is_support'] = 1
|
||||
constraints['txo_type'] = TXO_TYPES['support']
|
||||
|
||||
def get_supports(self, **constraints):
|
||||
self.constrain_supports(constraints)
|
||||
@@ -144,12 +142,12 @@ class WalletDatabase(BaseDatabase):
|
||||
)
|
||||
|
||||
def get_supports_summary(self, account_id):
|
||||
return self.db.execute_fetchall("""
|
||||
return self.db.execute_fetchall(f"""
|
||||
select txo.amount, exists(select * from txi where txi.txoid=txo.txoid) as spent,
|
||||
(txo.txid in
|
||||
(select txi.txid from txi join pubkey_address a on txi.address = a.address
|
||||
where a.account = ?)) as from_me,
|
||||
(txo.address in (select address from pubkey_address where account=?)) as to_me,
|
||||
tx.height
|
||||
from txo join tx using (txid) where is_support=1
|
||||
from txo join tx using (txid) where txo_type={TXO_TYPES['support']}
|
||||
""", (account_id, account_id))
|
||||
@@ -9,7 +9,6 @@ from torba.client.baseaccount import SingleKey
|
||||
from lbry.schema.result import Outputs
|
||||
from lbry.schema.url import URL
|
||||
from lbry.wallet.dewies import dewies_to_lbc
|
||||
from lbry.wallet.resolve import Resolver
|
||||
from lbry.wallet.account import Account
|
||||
from lbry.wallet.network import Network
|
||||
from lbry.wallet.database import WalletDatabase
|
||||
@@ -52,7 +51,6 @@ class MainNetLedger(BaseLedger):
|
||||
def __init__(self, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
self.fee_per_name_char = self.config.get('fee_per_name_char', self.default_fee_per_name_char)
|
||||
self.resolver = Resolver(self)
|
||||
|
||||
async def _inflate_outputs(self, query):
|
||||
outputs = Outputs.from_base64(await query)
|
||||
@@ -112,7 +110,7 @@ class MainNetLedger(BaseLedger):
|
||||
|
||||
@staticmethod
|
||||
def constraint_spending_utxos(constraints):
|
||||
constraints.update({'is_claim': 0, 'is_update': 0, 'is_support': 0})
|
||||
constraints['txo_type'] = 0
|
||||
|
||||
def get_utxos(self, **constraints):
|
||||
self.constraint_spending_utxos(constraints)
|
||||
|
||||
@@ -199,6 +199,8 @@ class LbryWalletManager(BaseWalletManager):
|
||||
if not tx:
|
||||
try:
|
||||
raw = await self.ledger.network.get_transaction(txid)
|
||||
if not raw:
|
||||
return {'success': False, 'code': 404, 'message': 'transaction not found'}
|
||||
height = await self.ledger.network.get_transaction_height(txid)
|
||||
except CodeMessageError as e:
|
||||
return {'success': False, 'code': e.code, 'message': e.message}
|
||||
|
||||
@@ -1,404 +0,0 @@
|
||||
import logging
|
||||
|
||||
import asyncio
|
||||
|
||||
from binascii import unhexlify, hexlify
|
||||
from lbry.utils import lru_cache_concurrent
|
||||
from lbry.wallet.account import validate_claim_id
|
||||
from lbry.wallet.dewies import dewies_to_lbc
|
||||
from lbry.error import UnknownNameError, UnknownClaimID, UnknownURI, UnknownOutpoint
|
||||
from lbry.schema.claim import Claim
|
||||
from google.protobuf.message import DecodeError
|
||||
from lbry.schema.url import URL
|
||||
from lbry.wallet.claim_proofs import verify_proof, InvalidProofError
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class Resolver:
|
||||
|
||||
def __init__(self, ledger):
|
||||
self.transaction_class = ledger.transaction_class
|
||||
self.network = ledger.network
|
||||
self.ledger = ledger
|
||||
|
||||
async def resolve(self, page, page_size, *uris):
|
||||
uris = set(uris)
|
||||
try:
|
||||
for uri in uris:
|
||||
for part in URL.parse(uri).parts:
|
||||
if part.claim_id:
|
||||
validate_claim_id(part.claim_id)
|
||||
claim_trie_root = self.ledger.headers.claim_trie_root
|
||||
resolutions = await self.network.get_values_for_uris(self.ledger.headers.hash().decode(), *uris)
|
||||
if len(uris) > 1:
|
||||
return await self._batch_handle(resolutions, uris, page, page_size, claim_trie_root)
|
||||
return await self._handle_resolutions(resolutions, uris, page, page_size, claim_trie_root)
|
||||
except ValueError as err:
|
||||
return {'error': err.args[0]}
|
||||
except Exception as e:
|
||||
log.exception(e)
|
||||
return {'error': str(e)}
|
||||
|
||||
async def _batch_handle(self, resolutions, uris, page, page_size, claim_trie_root):
|
||||
futs = []
|
||||
for uri in uris:
|
||||
futs.append(
|
||||
asyncio.ensure_future(self._handle_resolutions(resolutions, [uri], page, page_size, claim_trie_root))
|
||||
)
|
||||
results = await asyncio.gather(*futs)
|
||||
return dict(list(map(lambda result: list(result.items())[0], results)))
|
||||
|
||||
@lru_cache_concurrent(256)
|
||||
async def _fetch_tx(self, txid):
|
||||
return self.transaction_class(unhexlify(await self.network.get_transaction(txid)))
|
||||
|
||||
async def _handle_resolutions(self, resolutions, requested_uris, page, page_size, claim_trie_root):
|
||||
results = {}
|
||||
for uri in requested_uris:
|
||||
resolution = (resolutions or {}).get(uri, {})
|
||||
if resolution:
|
||||
try:
|
||||
results[uri] = _handle_claim_result(
|
||||
await self._handle_resolve_uri_response(uri, resolution, claim_trie_root, page, page_size),
|
||||
uri
|
||||
)
|
||||
except (UnknownNameError, UnknownClaimID, UnknownURI) as err:
|
||||
log.exception(err)
|
||||
results[uri] = {'error': str(err)}
|
||||
else:
|
||||
results[uri] = {'error': "URI lbry://{} cannot be resolved".format(uri.replace("lbry://", ""))}
|
||||
return results
|
||||
|
||||
async def _handle_resolve_uri_response(self, uri, resolution, claim_trie_root, page=0, page_size=10):
|
||||
result = {}
|
||||
parsed_uri = URL.parse(uri)
|
||||
certificate_response = None
|
||||
# parse an included certificate
|
||||
if 'certificate' in resolution:
|
||||
certificate_response = resolution['certificate']['result']
|
||||
certificate_resolution_type = resolution['certificate']['resolution_type']
|
||||
if certificate_resolution_type == "winning" and certificate_response:
|
||||
if 'height' in certificate_response:
|
||||
certificate_response = _verify_proof(parsed_uri.stream.name,
|
||||
claim_trie_root,
|
||||
certificate_response,
|
||||
ledger=self.ledger)
|
||||
elif certificate_resolution_type not in ['winning', 'claim_id', 'sequence']:
|
||||
raise Exception(f"unknown response type: {certificate_resolution_type}")
|
||||
result['certificate'] = await self.parse_and_validate_claim_result(certificate_response)
|
||||
result['claims_in_channel'] = len(resolution.get('unverified_claims_in_channel', []))
|
||||
|
||||
# if this was a resolution for a name, parse the result
|
||||
if 'claim' in resolution:
|
||||
claim_response = resolution['claim']['result']
|
||||
claim_resolution_type = resolution['claim']['resolution_type']
|
||||
if claim_resolution_type == "winning" and claim_response:
|
||||
if 'height' in claim_response:
|
||||
claim_response = _verify_proof(parsed_uri.stream.name,
|
||||
claim_trie_root,
|
||||
claim_response,
|
||||
ledger=self.ledger)
|
||||
elif claim_resolution_type not in ["sequence", "winning", "claim_id"]:
|
||||
raise Exception(f"unknown response type: {claim_resolution_type}")
|
||||
result['claim'] = await self.parse_and_validate_claim_result(claim_response,
|
||||
certificate_response)
|
||||
|
||||
# if this was a resolution for a name in a channel make sure there is only one valid
|
||||
# match
|
||||
elif 'unverified_claims_for_name' in resolution and 'certificate' in result:
|
||||
unverified_claims_for_name = resolution['unverified_claims_for_name']
|
||||
|
||||
channel_info = await self.get_channel_claims_page(unverified_claims_for_name,
|
||||
result['certificate'], page=1)
|
||||
claims_in_channel, upper_bound = channel_info
|
||||
|
||||
if not claims_in_channel:
|
||||
log.error("No valid claims for this name for this channel")
|
||||
elif len(claims_in_channel) > 1:
|
||||
log.warning("Multiple signed claims for the same name.")
|
||||
winner = pick_winner_from_channel_path_collision(claims_in_channel)
|
||||
if winner:
|
||||
result['claim'] = winner
|
||||
else:
|
||||
log.error("No valid claims for this name for this channel")
|
||||
else:
|
||||
result['claim'] = claims_in_channel[0]
|
||||
|
||||
# parse and validate claims in a channel iteratively into pages of results
|
||||
elif 'unverified_claims_in_channel' in resolution and 'certificate' in result:
|
||||
ids_to_check = resolution['unverified_claims_in_channel']
|
||||
channel_info = await self.get_channel_claims_page(ids_to_check, result['certificate'],
|
||||
page=page, page_size=page_size)
|
||||
claims_in_channel, upper_bound = channel_info
|
||||
|
||||
if claims_in_channel:
|
||||
result['total_claims'] = upper_bound
|
||||
result['claims_in_channel'] = claims_in_channel
|
||||
elif 'error' not in result:
|
||||
return {'error': 'claim not found', 'success': False, 'uri': str(parsed_uri)}
|
||||
|
||||
# invalid signatures can only return outside a channel
|
||||
if result.get('claim', {}).get('has_signature', False):
|
||||
if parsed_uri.has_stream and not result['claim']['signature_is_valid']:
|
||||
return {'error': 'claim not found', 'success': False, 'uri': str(parsed_uri)}
|
||||
return result
|
||||
|
||||
async def parse_and_validate_claim_result(self, claim_result, certificate=None):
|
||||
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
|
||||
if claim_result['value'].is_signed:
|
||||
claim_result['has_signature'] = True
|
||||
claim_tx = await self._fetch_tx(claim_result['txid'])
|
||||
if certificate is None:
|
||||
log.info("fetching certificate to check claim signature")
|
||||
channel_id = claim_result['value'].signing_channel_id
|
||||
certificate = (await self.network.get_claims_by_ids([channel_id])).get(channel_id)
|
||||
if not certificate:
|
||||
log.warning('Certificate %s not found', channel_id)
|
||||
claim_result['channel_name'] = certificate['name'] if certificate else None
|
||||
cert_tx = await self._fetch_tx(certificate['txid']) if certificate else None
|
||||
claim_result['signature_is_valid'] = validate_claim_signature_and_get_channel_name(
|
||||
claim_result, certificate, self.ledger, claim_tx=claim_tx, cert_tx=cert_tx
|
||||
)
|
||||
# fixme: workaround while json encoder isnt used here
|
||||
if cert_tx:
|
||||
channel_txo = cert_tx.outputs[certificate['nout']]
|
||||
claim_result['signing_channel'] = {
|
||||
'name': channel_txo.claim_name,
|
||||
'claim_id': channel_txo.claim_id,
|
||||
'value': channel_txo.claim
|
||||
}
|
||||
claim_result['is_channel_signature_valid'] = claim_result['signature_is_valid']
|
||||
|
||||
if 'amount' in claim_result:
|
||||
claim_result['amount'] = dewies_to_lbc(claim_result['amount'])
|
||||
claim_result['effective_amount'] = dewies_to_lbc(claim_result['effective_amount'])
|
||||
claim_result['supports'] = [
|
||||
{'txid': txid, 'nout': nout, 'amount': dewies_to_lbc(amount)}
|
||||
for (txid, nout, amount) in claim_result['supports']
|
||||
]
|
||||
|
||||
claim_result['height'] = claim_result.get('height', -1) or -1
|
||||
claim_result['permanent_url'] = f"lbry://{claim_result['name']}#{claim_result['claim_id']}"
|
||||
|
||||
return claim_result
|
||||
|
||||
@staticmethod
|
||||
def prepare_claim_queries(start_position, query_size, channel_claim_infos):
|
||||
queries = [tuple()]
|
||||
names = {}
|
||||
# a table of index counts for the sorted claim ids, including ignored claims
|
||||
absolute_position_index = {}
|
||||
|
||||
block_sorted_infos = sorted(channel_claim_infos.items(), key=lambda x: int(x[1][1]))
|
||||
per_block_infos = {}
|
||||
for claim_id, (name, height) in block_sorted_infos:
|
||||
claims = per_block_infos.get(height, [])
|
||||
claims.append((claim_id, name))
|
||||
per_block_infos[height] = sorted(claims, key=lambda x: int(x[0], 16))
|
||||
|
||||
abs_position = 0
|
||||
|
||||
for height in sorted(per_block_infos.keys(), reverse=True):
|
||||
for claim_id, name in per_block_infos[height]:
|
||||
names[claim_id] = name
|
||||
absolute_position_index[claim_id] = abs_position
|
||||
if abs_position >= start_position:
|
||||
if len(queries[-1]) >= query_size:
|
||||
queries.append(tuple())
|
||||
queries[-1] += (claim_id,)
|
||||
abs_position += 1
|
||||
return queries, names, absolute_position_index
|
||||
|
||||
async def iter_channel_claims_pages(self, queries, claim_positions, claim_names, certificate,
|
||||
page_size=10):
|
||||
# lbryum server returns a dict of {claim_id: (name, claim_height)}
|
||||
# first, sort the claims by block height (and by claim id int value within a block).
|
||||
|
||||
# map the sorted claims into getclaimsbyids queries of query_size claim ids each
|
||||
|
||||
# send the batched queries to lbryum server and iteratively validate and parse
|
||||
# the results, yield a page of results at a time.
|
||||
|
||||
# these results can include those where `signature_is_valid` is False. if they are skipped,
|
||||
# page indexing becomes tricky, as the number of results isn't known until after having
|
||||
# processed them.
|
||||
# TODO: fix ^ in lbry.schema
|
||||
|
||||
async def iter_validate_channel_claims():
|
||||
formatted_claims = []
|
||||
for claim_ids in queries:
|
||||
batch_result = await self.network.get_claims_by_ids(claim_ids)
|
||||
for claim_id in claim_ids:
|
||||
claim = batch_result[claim_id]
|
||||
if claim['name'] == claim_names[claim_id]:
|
||||
formatted_claim = await self.parse_and_validate_claim_result(claim, certificate)
|
||||
formatted_claim['absolute_channel_position'] = claim_positions[
|
||||
claim['claim_id']]
|
||||
formatted_claims.append(formatted_claim)
|
||||
else:
|
||||
log.warning("ignoring claim with name mismatch %s %s", claim['name'],
|
||||
claim['claim_id'])
|
||||
return formatted_claims
|
||||
|
||||
results = []
|
||||
|
||||
for claim in await iter_validate_channel_claims():
|
||||
results.append(claim)
|
||||
|
||||
# if there is a full page of results, yield it
|
||||
if len(results) and len(results) % page_size == 0:
|
||||
return results[-page_size:]
|
||||
|
||||
return results
|
||||
|
||||
async def get_channel_claims_page(self, channel_claim_infos, certificate, page, page_size=10):
|
||||
page = page or 0
|
||||
page_size = max(page_size, 1)
|
||||
if page_size > 500:
|
||||
raise Exception("page size above maximum allowed")
|
||||
start_position = (page - 1) * page_size
|
||||
queries, names, claim_positions = self.prepare_claim_queries(start_position, page_size,
|
||||
channel_claim_infos)
|
||||
upper_bound = len(claim_positions)
|
||||
if not page:
|
||||
return None, upper_bound
|
||||
if start_position > upper_bound:
|
||||
raise IndexError("claim %i greater than max %i" % (start_position, upper_bound))
|
||||
page_generator = await self.iter_channel_claims_pages(queries, claim_positions, names,
|
||||
certificate, page_size=page_size)
|
||||
return page_generator, upper_bound
|
||||
|
||||
|
||||
def _verify_proof(name, claim_trie_root, result, ledger):
|
||||
"""
|
||||
Verify proof for name claim
|
||||
"""
|
||||
support_amount = sum([amt for (stxid, snout, amt) in result['supports']])
|
||||
|
||||
def _build_response(name, tx, nOut):
|
||||
output = tx.outputs[nOut]
|
||||
r = {
|
||||
'name': name,
|
||||
'value': hexlify(output.script.values['claim']),
|
||||
'claim_id': output.claim_id,
|
||||
'txid': tx.id,
|
||||
'nout': nOut,
|
||||
'amount': output.amount,
|
||||
'effective_amount': output.amount + support_amount,
|
||||
'height': result['height'],
|
||||
'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
|
||||
|
||||
def _parse_proof_result(name, result):
|
||||
if 'txhash' in result['proof'] and 'nOut' in result['proof']:
|
||||
if 'transaction' in result:
|
||||
tx = ledger.transaction_class(raw=unhexlify(result['transaction']))
|
||||
nOut = result['proof']['nOut']
|
||||
if result['proof']['txhash'] == tx.id:
|
||||
if 0 <= nOut < len(tx.outputs):
|
||||
if tx.outputs[nOut].claim_name == name:
|
||||
return _build_response(name, tx, nOut)
|
||||
return {'error': 'name in proof did not match requested name'}
|
||||
outputs = len(tx['outputs'])
|
||||
return {'error': 'invalid nOut: %d (let(outputs): %d' % (nOut, outputs)}
|
||||
return {'error': "computed txid did not match given transaction: %s vs %s" %
|
||||
(tx.id, result['proof']['txhash'])
|
||||
}
|
||||
return {'error': "didn't receive a transaction with the proof"}
|
||||
return {'error': 'name is not claimed'}
|
||||
|
||||
if 'proof' in result:
|
||||
name = result.get('name', name)
|
||||
proof_name = result.get('normalized_name', name)
|
||||
try:
|
||||
verify_proof(result['proof'], claim_trie_root, proof_name)
|
||||
except InvalidProofError:
|
||||
return {'error': "Proof was invalid"}
|
||||
return _parse_proof_result(name, result)
|
||||
else:
|
||||
return {'error': "proof not in result"}
|
||||
|
||||
|
||||
def validate_claim_signature_and_get_channel_name(claim_result, certificate_claim, ledger,
|
||||
claim_tx=None, cert_tx=None):
|
||||
valid_signature = False
|
||||
if cert_tx and certificate_claim and claim_tx and claim_result:
|
||||
valid_signature = claim_tx.outputs[claim_result['nout']].is_signed_by(
|
||||
cert_tx.outputs[certificate_claim['nout']], ledger
|
||||
)
|
||||
if not valid_signature:
|
||||
log.warning("lbry://%s#%s has an invalid signature",
|
||||
claim_result['name'], claim_result['claim_id'])
|
||||
return valid_signature
|
||||
|
||||
|
||||
# TODO: The following came from code handling lbryum results. Now that it's all in one place a refactor should unify it.
|
||||
def _decode_claim_result(claim):
|
||||
if 'decoded_claim' in claim:
|
||||
return claim
|
||||
if 'value' not in claim:
|
||||
log.warning('Got an invalid claim while parsing, please report: %s', claim)
|
||||
claim['protobuf'] = None
|
||||
claim['value'] = None
|
||||
backend_message = ' SDK message: ' + claim.get('error', '')
|
||||
claim['error'] = "Failed to parse: missing value." + backend_message
|
||||
return claim
|
||||
try:
|
||||
if not isinstance(claim['value'], Claim):
|
||||
claim['value'] = Claim.from_bytes(unhexlify(claim['value']))
|
||||
claim['protobuf'] = hexlify(claim['value'].to_bytes())
|
||||
claim['decoded_claim'] = True
|
||||
except DecodeError:
|
||||
claim['decoded_claim'] = False
|
||||
claim['protobuf'] = claim['value']
|
||||
claim['value'] = None
|
||||
return claim
|
||||
|
||||
|
||||
def _handle_claim_result(results, uri):
|
||||
if not results:
|
||||
raise UnknownURI(uri)
|
||||
|
||||
if 'error' in results:
|
||||
if results['error'] in ['name is not claimed', 'claim not found']:
|
||||
if 'claim_id' in results:
|
||||
raise UnknownClaimID(results['claim_id'])
|
||||
if 'name' in results:
|
||||
raise UnknownNameError(results['name'])
|
||||
if 'uri' in results:
|
||||
raise UnknownURI(results['uri'])
|
||||
if 'outpoint' in results:
|
||||
raise UnknownOutpoint(results['outpoint'])
|
||||
raise Exception(results['error'])
|
||||
if not {'value', 'claim', 'certificate'}.intersection(results.keys()):
|
||||
raise Exception(f'result in unexpected format:{results}')
|
||||
return results
|
||||
|
||||
|
||||
def pick_winner_from_channel_path_collision(claims_in_channel):
|
||||
# we should be doing this by effective amount so we pick the controlling claim, however changing the resolved
|
||||
# claim triggers another issue where 2 claims cant be saved for the same file. This code picks the oldest, so it
|
||||
# stays the same. Using effective amount would change the resolved claims for a channel path on takeovers,
|
||||
# potentially triggering that.
|
||||
winner = {}
|
||||
for claim in claims_in_channel:
|
||||
if not winner or claim['height'] < winner['height'] or \
|
||||
(claim['height'] == winner['height'] and claim['nout'] < winner['nout']):
|
||||
winner = claim if claim['signature_is_valid'] else winner
|
||||
return winner or None
|
||||
@@ -1,3 +1,4 @@
|
||||
import os
|
||||
import sqlite3
|
||||
from typing import Union, Tuple, Set, List
|
||||
from itertools import chain
|
||||
@@ -705,7 +706,8 @@ class LBRYDB(DB):
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
self.sql = SQLDB(self, 'claims.db')
|
||||
path = os.path.join(self.env.db_dir, 'claims.db')
|
||||
self.sql = SQLDB(self, path)
|
||||
|
||||
def close(self):
|
||||
super().close()
|
||||
|
||||
@@ -52,7 +52,7 @@ class APICallMetrics:
|
||||
self.errored_queries = set()
|
||||
self.interrupted_queries = set()
|
||||
|
||||
def to_json_and_reset(self):
|
||||
def to_json(self):
|
||||
return {
|
||||
# total requests received
|
||||
"receive_count": self.receive_count,
|
||||
@@ -128,7 +128,7 @@ class ServerLoadData:
|
||||
def to_json_and_reset(self, status):
|
||||
try:
|
||||
return {
|
||||
'api': {name: api.to_json_and_reset() for name, api in self._apis.items()},
|
||||
'api': {name: api.to_json() for name, api in self._apis.items()},
|
||||
'status': status
|
||||
}
|
||||
finally:
|
||||
|
||||
@@ -64,9 +64,10 @@ class LBRYSessionManager(SessionManager):
|
||||
|
||||
async def start_other(self):
|
||||
self.running = True
|
||||
path = os.path.join(self.env.db_dir, 'claims.db')
|
||||
args = dict(
|
||||
initializer=reader.initializer,
|
||||
initargs=(self.logger, 'claims.db', self.env.coin.NET, self.env.database_query_timeout,
|
||||
initargs=(self.logger, path, self.env.coin.NET, self.env.database_query_timeout,
|
||||
self.env.track_metrics)
|
||||
)
|
||||
if self.env.max_query_workers is not None and self.env.max_query_workers == 0:
|
||||
@@ -112,33 +113,44 @@ class LBRYElectrumX(ElectrumX):
|
||||
}
|
||||
self.request_handlers.update(handlers)
|
||||
|
||||
async def run_in_executor(self, metrics: APICallMetrics, func, kwargs):
|
||||
def get_metrics_or_placeholder_for_api(self, query_name):
|
||||
""" Do not hold on to a reference to the metrics
|
||||
returned by this method past an `await` or
|
||||
you may be working with a stale metrics object.
|
||||
"""
|
||||
if self.env.track_metrics:
|
||||
return self.session_mgr.metrics.for_api(query_name)
|
||||
else:
|
||||
return APICallMetrics(query_name)
|
||||
|
||||
async def run_in_executor(self, query_name, func, kwargs):
|
||||
start = time.perf_counter()
|
||||
try:
|
||||
result = await asyncio.get_running_loop().run_in_executor(
|
||||
self.session_mgr.query_executor, func, kwargs
|
||||
)
|
||||
except reader.SQLiteInterruptedError as error:
|
||||
metrics = self.get_metrics_or_placeholder_for_api(query_name)
|
||||
metrics.query_interrupt(start, error.metrics)
|
||||
raise RPCError(JSONRPC.QUERY_TIMEOUT, 'sqlite query timed out')
|
||||
except reader.SQLiteOperationalError as error:
|
||||
metrics = self.get_metrics_or_placeholder_for_api(query_name)
|
||||
metrics.query_error(start, error.metrics)
|
||||
raise RPCError(JSONRPC.INTERNAL_ERROR, 'query failed to execute')
|
||||
except:
|
||||
metrics = self.get_metrics_or_placeholder_for_api(query_name)
|
||||
metrics.query_error(start, {})
|
||||
raise RPCError(JSONRPC.INTERNAL_ERROR, 'unknown server error')
|
||||
|
||||
if self.env.track_metrics:
|
||||
metrics = self.get_metrics_or_placeholder_for_api(query_name)
|
||||
(result, metrics_data) = result
|
||||
metrics.query_response(start, metrics_data)
|
||||
|
||||
return base64.b64encode(result).decode()
|
||||
|
||||
async def run_and_cache_query(self, query_name, function, kwargs):
|
||||
if self.env.track_metrics:
|
||||
metrics = self.session_mgr.metrics.for_api(query_name)
|
||||
else:
|
||||
metrics = APICallMetrics(query_name)
|
||||
metrics = self.get_metrics_or_placeholder_for_api(query_name)
|
||||
metrics.start()
|
||||
cache = self.session_mgr.search_cache[query_name]
|
||||
cache_key = str(kwargs)
|
||||
@@ -151,9 +163,10 @@ class LBRYElectrumX(ElectrumX):
|
||||
async with cache_item.lock:
|
||||
if cache_item.result is None:
|
||||
cache_item.result = await self.run_in_executor(
|
||||
metrics, function, kwargs
|
||||
query_name, function, kwargs
|
||||
)
|
||||
else:
|
||||
metrics = self.get_metrics_or_placeholder_for_api(query_name)
|
||||
metrics.cache_response()
|
||||
return cache_item.result
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ RUN mkdir -p /home/$user/
|
||||
RUN chown -R $user:$user /home/$user/
|
||||
|
||||
# install python, pip, git and clean up
|
||||
RUN apt-get update && apt-get -y --no-install-recommends install build-essential git python3.7 python3.7-dev python3-pip && rm -rf /var/lib/apt/lists/*
|
||||
RUN apt-get update && apt-get -y --no-install-recommends install build-essential git tar wget python3.7 python3.7-dev python3-pip && rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# create and chown database dir
|
||||
ARG db_dir=/database
|
||||
@@ -53,4 +53,5 @@ ENV BANDWIDTH_LIMIT=1000000000000000000000000000000000000000000
|
||||
ENV MAX_SESSIONS=1000000000
|
||||
ENV MAX_SEND=1000000000000000000
|
||||
ENV EVENT_LOOP_POLICY=uvloop
|
||||
ENTRYPOINT ["/home/lbry/.local/bin/torba-server"]
|
||||
COPY ./lbry/scripts/wallet_server_entrypoint.sh /entrypoint.sh
|
||||
ENTRYPOINT ["/entrypoint.sh"]
|
||||
@@ -78,11 +78,31 @@ class Examples(CommandTestCase):
|
||||
'Get version',
|
||||
'version'
|
||||
)
|
||||
|
||||
# settings
|
||||
|
||||
await r(
|
||||
'Get settings',
|
||||
'settings', 'get'
|
||||
)
|
||||
|
||||
await r(
|
||||
'Set settings',
|
||||
'settings', 'set', '"tcp_port"', '99'
|
||||
)
|
||||
|
||||
# preferences
|
||||
|
||||
await r(
|
||||
'Set preference',
|
||||
'preference', 'set', '"theme"', '"dark"'
|
||||
)
|
||||
|
||||
await r(
|
||||
'Get preferences',
|
||||
'preference', 'get'
|
||||
)
|
||||
|
||||
# accounts
|
||||
|
||||
await r(
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
import asyncio
|
||||
from torba.client.basenetwork import ClientSession
|
||||
from torba.rpc.jsonrpc import RPCError
|
||||
import logging
|
||||
import json
|
||||
import sys
|
||||
|
||||
logging.getLogger('torba').setLevel(logging.CRITICAL)
|
||||
|
||||
|
||||
async def main():
|
||||
try:
|
||||
hostname = sys.argv[1]
|
||||
except IndexError:
|
||||
hostname = 'spv1.lbry.com'
|
||||
|
||||
loop = asyncio.get_event_loop()
|
||||
client = ClientSession(network=None, server=(hostname, 50001))
|
||||
error = None
|
||||
args = {
|
||||
'any_tags': ['art'],
|
||||
'not_tags': ['xxx', 'porn', 'mature', 'nsfw', 'titan'],
|
||||
'order_by': ["name"],
|
||||
'offset': 3000,
|
||||
'limit': 200,
|
||||
'no_totals': False,
|
||||
}
|
||||
|
||||
start = loop.time()
|
||||
try:
|
||||
await client.create_connection()
|
||||
try:
|
||||
await client.send_request('blockchain.claimtrie.search', args)
|
||||
except RPCError as err:
|
||||
error = err
|
||||
finally:
|
||||
await client.close()
|
||||
finally:
|
||||
print(json.dumps({
|
||||
"time": loop.time() - start,
|
||||
"error": error.__str__() if error else None,
|
||||
"args": args,
|
||||
}, indent=4))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
asyncio.run(main())
|
||||
Executable
+15
@@ -0,0 +1,15 @@
|
||||
#!/bin/bash
|
||||
|
||||
# entrypoint for wallet server Docker image
|
||||
|
||||
SNAPSHOT_URL="${SNAPSHOT_URL:-}" #off by default. latest snapshot at https://lbry.com/snapshot/wallet
|
||||
|
||||
if [[ -n "$SNAPSHOT_URL" ]] && [[ ! -f /database/claims.db ]]; then
|
||||
echo "Downloading wallet snapshot from $SNAPSHOT_URL"
|
||||
wget -O wallet_snapshot.tar.bz2 "$SNAPSHOT_URL"
|
||||
echo "Extracting snapshot..."
|
||||
tar xvjf wallet_snapshot.tar.bz2 --directory /database
|
||||
rm wallet_snapshot.tar.bz2
|
||||
fi
|
||||
|
||||
/home/lbry/.local/bin/torba-server "$@"
|
||||
@@ -1,5 +1,9 @@
|
||||
import asyncio
|
||||
import sqlite3
|
||||
from lbry.testcase import CommandTestCase
|
||||
from torba.client.basedatabase import SQLiteMixin
|
||||
from lbry.wallet.dewies import dewies_to_lbc
|
||||
from lbry.wallet.account import Account
|
||||
|
||||
|
||||
def extract(d, keys):
|
||||
@@ -7,6 +11,13 @@ def extract(d, keys):
|
||||
|
||||
|
||||
class AccountManagement(CommandTestCase):
|
||||
async def test_sqlite_binding_error(self):
|
||||
tasks = [
|
||||
self.loop.create_task(self.daemon.jsonrpc_account_create('second account' + str(x))) for x in range(100)
|
||||
]
|
||||
await asyncio.wait(tasks)
|
||||
for result in tasks:
|
||||
self.assertFalse(isinstance(result.result(), Exception))
|
||||
|
||||
async def test_account_list_set_create_remove_add(self):
|
||||
# check initial account
|
||||
|
||||
@@ -499,44 +499,9 @@ class ChannelCommands(CommandTestCase):
|
||||
claim_id = self.get_claim_id(tx)
|
||||
channel_private_key = (await self.account.get_channels())[0].private_key
|
||||
exported_data = await self.out(self.daemon.jsonrpc_channel_export(claim_id))
|
||||
|
||||
daemon2 = await self.add_daemon()
|
||||
|
||||
# before importing channel
|
||||
self.assertEqual(1, len(daemon2.default_wallet.accounts))
|
||||
|
||||
# importing channel which will create a new single key account
|
||||
await daemon2.jsonrpc_channel_import(exported_data)
|
||||
|
||||
# after import
|
||||
self.assertEqual(2, len(daemon2.default_wallet.accounts))
|
||||
new_account = daemon2.default_wallet.accounts[1]
|
||||
await daemon2.ledger._update_tasks.done.wait()
|
||||
channels = await new_account.get_channels()
|
||||
self.assertEqual(1, len(channels))
|
||||
self.assertEqual(channel_private_key.to_string(), channels[0].private_key.to_string())
|
||||
|
||||
async def test_channel_export_import_into_existing_account(self):
|
||||
tx = await self.channel_create('@foo', '1.0')
|
||||
claim_id = self.get_claim_id(tx)
|
||||
channel_private_key = (await self.account.get_channels())[0].private_key
|
||||
exported_data = await self.out(self.daemon.jsonrpc_channel_export(claim_id))
|
||||
|
||||
daemon2 = await self.add_daemon(seed=self.account.seed)
|
||||
await daemon2.ledger._update_tasks.done.wait() # will sync channel previously created
|
||||
|
||||
# before importing channel key, has channel without key
|
||||
self.assertEqual(1, len(daemon2.default_wallet.accounts))
|
||||
channels = await daemon2.default_account.get_channels()
|
||||
self.assertEqual(1, len(channels))
|
||||
self.assertIsNone(channels[0].private_key)
|
||||
|
||||
# importing channel will add it to existing account
|
||||
await daemon2.jsonrpc_channel_import(exported_data)
|
||||
|
||||
# after import, still just one account but with private key now
|
||||
self.assertEqual(1, len(daemon2.default_wallet.accounts))
|
||||
channels = await daemon2.default_account.get_channels()
|
||||
channels = await daemon2.jsonrpc_channel_list()
|
||||
self.assertEqual(1, len(channels))
|
||||
self.assertEqual(channel_private_key.to_string(), channels[0].private_key.to_string())
|
||||
|
||||
@@ -653,6 +618,15 @@ class StreamCommands(ClaimTestCase):
|
||||
'hovercraft5', '0.1', channel_name='@baz', channel_account_id=[account1_id]
|
||||
)
|
||||
|
||||
# signing with channel works even if channel and certificate are in different accounts
|
||||
await self.channel_update(
|
||||
baz_id, account_id=account2_id,
|
||||
claim_address=await self.daemon.jsonrpc_address_unused(account1_id)
|
||||
)
|
||||
await self.stream_create(
|
||||
'hovercraft5', '0.1', channel_id=baz_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))
|
||||
|
||||
@@ -26,6 +26,7 @@ class MockedCommentServer:
|
||||
'signing_ts': None,
|
||||
'timestamp': None,
|
||||
'channel_url': None,
|
||||
'is_hidden': False,
|
||||
}
|
||||
|
||||
def __init__(self, port=2903):
|
||||
@@ -45,10 +46,9 @@ class MockedCommentServer:
|
||||
|
||||
@staticmethod
|
||||
def clean(d: dict):
|
||||
return {k: v for k, v in d.items() if v}
|
||||
return {k: v for k, v in d.items() if v or isinstance(v, bool)}
|
||||
|
||||
def create_comment(self, channel_name=None, channel_id=None, **kwargs):
|
||||
self.comment_id += 1
|
||||
comment_id = self.comment_id
|
||||
channel_url = 'lbry://' + channel_name + '#' + channel_id if channel_id else None
|
||||
comment = self._create_comment(
|
||||
@@ -60,57 +60,97 @@ class MockedCommentServer:
|
||||
**kwargs
|
||||
)
|
||||
self.comments.append(comment)
|
||||
self.comment_id += 1
|
||||
return self.clean(comment)
|
||||
|
||||
def delete_comment(self, comment_id: int, channel_id: str, **kwargs):
|
||||
def abandon_comment(self, comment_id: int, channel_id: str, **kwargs):
|
||||
deleted = False
|
||||
try:
|
||||
if 0 <= comment_id <= len(self.comments) and self.comments[comment_id - 1]['channel_id'] == channel_id:
|
||||
self.comments.pop(comment_id - 1)
|
||||
if 0 <= comment_id < len(self.comments) and self.comments[comment_id]['channel_id'] == channel_id:
|
||||
self.comments.pop(comment_id)
|
||||
deleted = True
|
||||
finally:
|
||||
return {
|
||||
str(comment_id): {
|
||||
'deleted': deleted
|
||||
'abandoned': deleted
|
||||
}
|
||||
}
|
||||
|
||||
def get_claim_comments(self, page=1, page_size=50, **kwargs):
|
||||
def hide_comment(self, comment_id, signing_ts, signature):
|
||||
comment_id = int(comment_id) if not isinstance(comment_id, int) else comment_id
|
||||
if 0 <= comment_id < len(self.comments) and len(signature) == 128 and signing_ts.isalnum():
|
||||
self.comments[comment_id]['is_hidden'] = True
|
||||
return True
|
||||
return False
|
||||
|
||||
def hide_comments(self, pieces: list):
|
||||
comments_hidden = []
|
||||
for p in pieces:
|
||||
if self.hide_comment(**p):
|
||||
comments_hidden.append(p['comment_id'])
|
||||
return {'hidden': comments_hidden}
|
||||
|
||||
def get_claim_comments(self, claim_id, page=1, page_size=50,**kwargs):
|
||||
comments = list(filter(lambda c: c['claim_id'] == claim_id, self.comments))
|
||||
return {
|
||||
'page': page,
|
||||
'page_size': page_size,
|
||||
'total_pages': ceil(len(self.comments)/page_size),
|
||||
'total_items': len(self.comments),
|
||||
'items': [self.clean(c) for c in (self.comments[::-1])[(page - 1) * page_size: page * page_size]]
|
||||
'total_pages': ceil(len(comments)/page_size),
|
||||
'total_items': len(comments),
|
||||
'items': [self.clean(c) for c in (comments[::-1])[(page - 1) * page_size: page * page_size]],
|
||||
'has_hidden_comments': bool(list(filter(lambda x: x['is_hidden'], comments)))
|
||||
}
|
||||
|
||||
def get_claim_hidden_comments(self, claim_id, hidden=True, page=1, page_size=50):
|
||||
comments = list(filter(lambda c: c['claim_id'] == claim_id, self.comments))
|
||||
select_comments = list(filter(lambda c: c['is_hidden'] == hidden, comments))
|
||||
return {
|
||||
'page': page,
|
||||
'page_size': page_size,
|
||||
'total_pages': ceil(len(select_comments) / page_size),
|
||||
'total_items': len(select_comments),
|
||||
'items': [self.clean(c) for c in (select_comments[::-1])[(page - 1) * page_size: page * page_size]],
|
||||
'has_hidden_comments': bool(list(filter(lambda c: c['is_hidden'], comments)))
|
||||
}
|
||||
|
||||
def get_comment_channel_by_id(self, comment_id: int, **kwargs):
|
||||
comment = self.comments[comment_id - 1]
|
||||
comment = self.comments[comment_id]
|
||||
return {
|
||||
'channel_id': comment.get('channel_id'),
|
||||
'channel_name': comment.get('channel_name')
|
||||
}
|
||||
|
||||
def get_comments_by_id(self, comment_ids: list):
|
||||
comment_ids = [int(c) if not isinstance(c, int) else c for c in comment_ids]
|
||||
comments = [self.comments[cmnt_id] for cmnt_id in comment_ids if 0 <= cmnt_id < len(self.comments)]
|
||||
return comments
|
||||
|
||||
methods = {
|
||||
'get_claim_comments': get_claim_comments,
|
||||
'get_comments_by_id': get_comments_by_id,
|
||||
'create_comment': create_comment,
|
||||
'delete_comment': delete_comment,
|
||||
'abandon_comment': abandon_comment,
|
||||
'get_channel_from_comment_id': get_comment_channel_by_id,
|
||||
'get_claim_hidden_comments': get_claim_hidden_comments,
|
||||
'hide_comments': hide_comments,
|
||||
}
|
||||
|
||||
def process_json(self, body) -> dict:
|
||||
response = {'jsonrpc': '2.0', 'id': body['id']}
|
||||
try:
|
||||
if body['method'] in self.methods:
|
||||
params = body.get('params', {})
|
||||
if 'comment_id' in params and type(params['comment_id']) is str:
|
||||
params['comment_id'] = int(params['comment_id'])
|
||||
params: dict = body.get('params', {})
|
||||
comment_id = params.get('comment_id')
|
||||
if comment_id and not isinstance(comment_id, int):
|
||||
params['comment_id'] = int(comment_id)
|
||||
|
||||
result = self.methods[body['method']](self, **params)
|
||||
response['result'] = result
|
||||
else:
|
||||
response['error'] = self.ERRORS['INVALID_METHOD']
|
||||
except Exception:
|
||||
except Exception as err:
|
||||
response['error'] = self.ERRORS['UNKNOWN']
|
||||
response['error'].update({'exception': f'{type(err).__name__}: {err}'})
|
||||
return response
|
||||
|
||||
async def start(self):
|
||||
@@ -181,20 +221,19 @@ class CommentCommands(CommandTestCase):
|
||||
async def test02_unsigned_comment_list(self):
|
||||
stream = (await self.stream_create())['outputs'][0]
|
||||
comments = []
|
||||
for i in range(28):
|
||||
num_items = 28
|
||||
for i in range(num_items):
|
||||
comment = await self.daemon.jsonrpc_comment_create(
|
||||
comment=f'{i}',
|
||||
claim_id=stream['claim_id'],
|
||||
)
|
||||
self.assertIn('comment_id', comment)
|
||||
comments.append(comment)
|
||||
|
||||
comment_list = await self.daemon.jsonrpc_comment_list(
|
||||
claim_id=stream['claim_id']
|
||||
)
|
||||
self.assertIs(comment_list['page_size'], 50)
|
||||
self.assertIs(comment_list['page'], 1)
|
||||
self.assertIs(comment_list['total_items'], 28)
|
||||
list_fields = ['items', 'page', 'page_size', 'has_hidden_comments', 'total_items', 'total_pages']
|
||||
comment_list = await self.daemon.jsonrpc_comment_list(stream['claim_id'])
|
||||
for field in list_fields:
|
||||
self.assertIn(field, comment_list)
|
||||
self.assertEqual(comment_list['total_items'], num_items)
|
||||
for comment in comment_list['items']:
|
||||
self.assertEqual(comment['comment'], comments.pop()['comment'])
|
||||
|
||||
@@ -216,10 +255,12 @@ class CommentCommands(CommandTestCase):
|
||||
)
|
||||
self.assertIn('comment_id', comment)
|
||||
comments.append(comment)
|
||||
|
||||
list_fields = ['items', 'page', 'page_size', 'has_hidden_comments', 'total_items', 'total_pages']
|
||||
comment_list = await self.daemon.jsonrpc_comment_list(
|
||||
claim_id=stream['claim_id']
|
||||
)
|
||||
for field in list_fields:
|
||||
self.assertIn(field, comment_list)
|
||||
self.assertIs(comment_list['page_size'], 50)
|
||||
self.assertIs(comment_list['page'], 1)
|
||||
self.assertIs(comment_list['total_items'], 28)
|
||||
@@ -241,10 +282,120 @@ class CommentCommands(CommandTestCase):
|
||||
channel_id=rswanson['claim_id']
|
||||
)
|
||||
self.assertIn('signature', comment)
|
||||
deleted = await self.daemon.jsonrpc_comment_abandon(comment['comment_id'])
|
||||
self.assertIn(comment['comment_id'], deleted)
|
||||
self.assertTrue(deleted[comment['comment_id']]['deleted'])
|
||||
abandoned = await self.daemon.jsonrpc_comment_abandon(comment['comment_id'])
|
||||
self.assertIn(comment['comment_id'], abandoned)
|
||||
self.assertTrue(abandoned[comment['comment_id']]['abandoned'])
|
||||
|
||||
deleted = await self.daemon.jsonrpc_comment_abandon(comment['comment_id'])
|
||||
self.assertIn(comment['comment_id'], deleted)
|
||||
self.assertFalse(deleted[comment['comment_id']]['deleted'])
|
||||
abandoned = await self.daemon.jsonrpc_comment_abandon(comment['comment_id'])
|
||||
self.assertFalse(abandoned[comment['comment_id']]['abandoned'])
|
||||
|
||||
async def test05_comment_hide(self):
|
||||
moth = (await self.channel_create('@InconspicuousMoth'))['outputs'][0]
|
||||
bee = (await self.channel_create('@LazyBumblebee'))['outputs'][0]
|
||||
moth_id = moth['claim_id']
|
||||
stream = await self.stream_create('Cool Lamps to Sit On', channel_id=moth_id)
|
||||
claim_id = stream['outputs'][0]['claim_id']
|
||||
|
||||
comment1 = await self.daemon.jsonrpc_comment_create(
|
||||
comment='Who on earth would want to sit around on a lamp all day',
|
||||
claim_id=claim_id,
|
||||
channel_id=bee['claim_id']
|
||||
)
|
||||
self.assertFalse(comment1['is_hidden'])
|
||||
|
||||
comment2 = await self.daemon.jsonrpc_comment_create(
|
||||
comment='silence mortal',
|
||||
claim_id=claim_id,
|
||||
channel_id=moth_id,
|
||||
)
|
||||
self.assertFalse(comment2['is_hidden'])
|
||||
|
||||
comments = await self.daemon.jsonrpc_comment_list(claim_id)
|
||||
self.assertIn('has_hidden_comments', comments)
|
||||
self.assertFalse(comments['has_hidden_comments'])
|
||||
|
||||
hidden = await self.daemon.jsonrpc_comment_hide([comment1['comment_id']])
|
||||
self.assertIn('hidden', hidden)
|
||||
hidden = hidden['hidden']
|
||||
self.assertIn(comment1['comment_id'], hidden)
|
||||
|
||||
comments = await self.daemon.jsonrpc_comment_list(claim_id)
|
||||
self.assertIn('has_hidden_comments', comments)
|
||||
self.assertTrue(comments['has_hidden_comments'])
|
||||
hidden_cmts1 = list(filter(lambda c: c['is_hidden'], comments['items']))
|
||||
self.assertTrue(len(hidden_cmts1) == 1)
|
||||
hidden_comment = hidden_cmts1[0]
|
||||
self.assertEqual(hidden_comment['comment_id'], hidden[0])
|
||||
|
||||
hidden_comments = await self.daemon.jsonrpc_comment_list(claim_id, hidden=True)
|
||||
self.assertIn('has_hidden_comments', hidden_comments)
|
||||
self.assertTrue(hidden_comments['has_hidden_comments'])
|
||||
self.assertLess(hidden_comments['total_items'], comments['total_items'])
|
||||
self.assertListEqual(hidden_comments['items'], hidden_cmts1)
|
||||
|
||||
visible_comments = await self.daemon.jsonrpc_comment_list(claim_id, visible=True)
|
||||
self.assertIn('has_hidden_comments', visible_comments)
|
||||
self.assertTrue(visible_comments['has_hidden_comments'])
|
||||
self.assertLess(visible_comments['total_items'], comments['total_items'])
|
||||
total_hidden = hidden_comments['total_items']
|
||||
total_visible = visible_comments['total_items']
|
||||
self.assertEqual(total_hidden + total_visible, comments['total_items'])
|
||||
|
||||
items_hidden = hidden_comments['items']
|
||||
items_visible = visible_comments['items']
|
||||
for item in items_visible + items_hidden:
|
||||
self.assertIn(item, comments['items'])
|
||||
|
||||
async def test06_comment_list_test(self):
|
||||
moth = (await self.channel_create('@InconspicuousMoth'))['outputs'][0]
|
||||
bee = (await self.channel_create('@LazyBumblebee'))['outputs'][0]
|
||||
moth_id = moth['claim_id']
|
||||
stream = await self.stream_create('Cool Lamps to Sit On', channel_id=moth_id)
|
||||
claim_id = stream['outputs'][0]['claim_id']
|
||||
hidden_comment = await self.daemon.jsonrpc_comment_create(
|
||||
comment='Who on earth would want to sit around on a lamp all day',
|
||||
claim_id=claim_id,
|
||||
channel_id=bee['claim_id']
|
||||
)
|
||||
await self.daemon.jsonrpc_comment_hide([hidden_comment['comment_id']])
|
||||
owner_comment = await self.daemon.jsonrpc_comment_create(
|
||||
comment='Go away you yellow freak',
|
||||
claim_id=claim_id,
|
||||
channel_id=moth_id,
|
||||
)
|
||||
other_comment = await self.daemon.jsonrpc_comment_create(
|
||||
comment='I got my swim trunks and my flippy-floppies',
|
||||
claim_id=claim_id,
|
||||
channel_id=bee['claim_id']
|
||||
)
|
||||
anon_comment = await self.daemon.jsonrpc_comment_create(
|
||||
claim_id=claim_id,
|
||||
comment='Anonymous comment'
|
||||
)
|
||||
all_comments = [anon_comment, other_comment, owner_comment, hidden_comment]
|
||||
list_fields = ['items', 'page', 'page_size', 'has_hidden_comments', 'total_items', 'total_pages']
|
||||
normal_list = await self.daemon.jsonrpc_comment_list(claim_id)
|
||||
for field in list_fields:
|
||||
self.assertIn(field, normal_list)
|
||||
self.assertEqual(normal_list['total_items'], 4)
|
||||
self.assertTrue(normal_list['has_hidden_comments'])
|
||||
for i, cmnt in enumerate(all_comments):
|
||||
self.assertEqual(cmnt['comment_id'], normal_list['items'][i]['comment_id'])
|
||||
|
||||
hidden = await self.daemon.jsonrpc_comment_list(claim_id, hidden=True)
|
||||
self.assertTrue(hidden['has_hidden_comments'])
|
||||
for field in list_fields:
|
||||
self.assertIn(field, hidden)
|
||||
self.assertEqual(hidden['total_items'], 1)
|
||||
|
||||
visible = await self.daemon.jsonrpc_comment_list(claim_id, visible=True)
|
||||
for field in list_fields:
|
||||
self.assertIn(field, visible)
|
||||
self.assertTrue(visible['has_hidden_comments'])
|
||||
self.assertEqual(visible['total_items'], normal_list['total_items'] - hidden['total_items'])
|
||||
|
||||
valid_list = await self.daemon.jsonrpc_comment_list(claim_id, is_channel_signature_valid=True)
|
||||
for field in list_fields:
|
||||
self.assertIn(field, valid_list)
|
||||
self.assertTrue(visible['has_hidden_comments'])
|
||||
self.assertEqual(len(valid_list['items']), len(normal_list['items']) - 1)
|
||||
@@ -34,7 +34,7 @@ class DHTIntegrationTest(AsyncioTestCase):
|
||||
|
||||
async def test_replace_bad_nodes(self):
|
||||
await self.setup_network(20)
|
||||
self.assertEquals(len(self.nodes), 20)
|
||||
self.assertEqual(len(self.nodes), 20)
|
||||
node = self.nodes[0]
|
||||
bad_peers = []
|
||||
for candidate in self.nodes[1:10]:
|
||||
|
||||
@@ -84,3 +84,31 @@ class AccountSynchronization(AsyncioTestCase):
|
||||
self.daemon.jsonrpc_sync_apply('password', data=add_cert)
|
||||
self.assertEqual(self.daemon.jsonrpc_sync_hash(), hash_w_cert)
|
||||
self.assertEqual(self.account.channel_keys, {'abcdefg1234:0': '---PRIVATE KEY---'})
|
||||
|
||||
@mock.patch('time.time', mock.Mock(return_value=12345))
|
||||
def test_account_preferences_syncing(self):
|
||||
starting_hash = '69afcd60a300f47933917d77ef011beeeb4decfafebbda91c144c84282c6814f'
|
||||
self.account.modified_on = 123.456
|
||||
self.assertEqual(self.daemon.jsonrpc_sync_hash(), starting_hash)
|
||||
self.assertEqual(self.daemon.jsonrpc_sync_apply('password')['hash'], starting_hash)
|
||||
self.assertFalse(self.daemon.jsonrpc_preference_get())
|
||||
|
||||
hash_w_pref = '2fe43f0b2f8bbf1fbb55537f862d8bcb0823791019a7151c848bd5f5bd32d336'
|
||||
add_pref = (
|
||||
'czo4MTkyOjE2OjE6Jgn3nAGrfYP2usMA4KQ/73+YHAwMyiGdSWuxCmgZKlpwSpnfQv8R7R0tum/n2oTSBQxjdL'
|
||||
'OlTW+tv/G5L2GfQ5op3xaT89gN+F/JJnvf3cdWvYH7Nc+uTUMb7cKhJP7hQvFW5bb1Y3jX3EBBY00Jkqyj9RCR'
|
||||
'XPtbLVu71KbVRvCAR/oAnMEsgD+ITsC3WkXMwE3BS2LjJDQmeqbH4YXNdcjJN/JzQ6fxOmr3Uk1GqnpuhFsta8'
|
||||
'H14ViRilq1pLKOSZIN80rrm5cKq45nFO5kFeoqBCEaal4u2/OkX9nOnpQlO3E95wD8hkCmZ3i20aSte6nqwqXx'
|
||||
'ZKVRZqR2a0TjwVWB8kPXPA2ewKvPILaj190bXPl8EVu+TAnTCQwMgytinYjtcKNZmMz3ENJyI2mCANwpWlX7xl'
|
||||
'y/J+qLi5b9N+agghTxggs5rVJ/hkaue7GS542dXDrwMrw9nwGqNw3dS/lcU+1wRUQ0fnHwb/85XbbwyO2aDj2i'
|
||||
'DFNkdyLyUIiIUvB1JfWAnWqX3vQcL1REK1ePgUei7dCHJ3WyWdsRx3cVXzlK8yOPkf0N6d3AKrZQWVebwDC7Nd'
|
||||
'eL4sDW8AkaXuBIrbuZw6XUHd6WI0NvU/q10j2qMm0YoXSu+dExou1/1THwx5g86MxcX5nwodKUEVCOTzKMyrLz'
|
||||
'CRsitH/+dAXhZNRp/FbnDCGBMyD3MOYCjZvAFbCZUasoRwqponxILw=='
|
||||
)
|
||||
self.daemon.jsonrpc_sync_apply('password', data=add_pref)
|
||||
self.assertEqual(self.daemon.jsonrpc_sync_hash(), hash_w_pref)
|
||||
self.assertEqual(self.daemon.jsonrpc_preference_get(), {"fruit": ["apple", "orange"]})
|
||||
|
||||
self.daemon.jsonrpc_preference_set("fruit", ["peach", "apricot"])
|
||||
self.assertEqual(self.daemon.jsonrpc_preference_get(), {"fruit": ["peach", "apricot"]})
|
||||
self.assertNotEqual(self.daemon.jsonrpc_sync_hash(), hash_w_pref)
|
||||
@@ -20,7 +20,9 @@ class TestSessionBloat(IntegrationTestCase):
|
||||
await self.ledger.stop()
|
||||
self.conductor.spv_node.session_timeout = 1
|
||||
await self.conductor.start_spv()
|
||||
session = ClientSession(network=None, server=self.ledger.network.client.server, timeout=0.2)
|
||||
session = ClientSession(
|
||||
network=None, server=(self.conductor.spv_node.hostname, self.conductor.spv_node.port), timeout=0.2
|
||||
)
|
||||
await session.create_connection()
|
||||
await session.send_request('server.banner', ())
|
||||
self.assertEqual(len(self.conductor.spv_node.server.session_mgr.sessions), 1)
|
||||
|
||||
@@ -43,11 +43,11 @@ class TestManagedStream(BlobExchangeTestBase):
|
||||
async def test_status_file_completed(self):
|
||||
await self._test_transfer_stream(10)
|
||||
self.assertTrue(self.stream.output_file_exists)
|
||||
self.assertTrue(self.stream.as_dict()['completed'])
|
||||
self.assertTrue(self.stream.completed)
|
||||
with open(self.stream.full_path, 'w+b') as outfile:
|
||||
outfile.truncate(1)
|
||||
self.assertTrue(self.stream.output_file_exists)
|
||||
self.assertFalse(self.stream.as_dict()['completed'])
|
||||
self.assertFalse(self.stream.completed)
|
||||
|
||||
async def _test_transfer_stream(self, blob_count: int, mock_accumulate_peers=None, stop_when_done=True):
|
||||
await self.setup_stream(blob_count)
|
||||
|
||||
@@ -3,6 +3,7 @@ import asyncio
|
||||
from unittest.mock import Mock
|
||||
|
||||
from torba.client.basenetwork import BaseNetwork
|
||||
from torba.orchstr8.node import SPVNode
|
||||
from torba.rpc import RPCSession
|
||||
from torba.testcase import IntegrationTestCase, AsyncioTestCase
|
||||
|
||||
@@ -20,6 +21,26 @@ class ReconnectTests(IntegrationTestCase):
|
||||
|
||||
VERBOSITY = logging.WARN
|
||||
|
||||
async def test_multiple_servers(self):
|
||||
# we have a secondary node that connects later, so
|
||||
node2 = SPVNode(self.conductor.spv_module, node_number=2)
|
||||
self.ledger.network.config['default_servers'].append((node2.hostname, node2.port))
|
||||
await asyncio.wait_for(self.ledger.stop(), timeout=1)
|
||||
await asyncio.wait_for(self.ledger.start(), timeout=1)
|
||||
self.ledger.network.session_pool.new_connection_event.clear()
|
||||
await node2.start(self.blockchain)
|
||||
# this is only to speed up the test as retrying would take 4+ seconds
|
||||
for session in self.ledger.network.session_pool.sessions:
|
||||
session.trigger_urgent_reconnect.set()
|
||||
await asyncio.wait_for(self.ledger.network.session_pool.new_connection_event.wait(), timeout=1)
|
||||
self.assertEqual(2, len(list(self.ledger.network.session_pool.available_sessions)))
|
||||
self.assertTrue(self.ledger.network.is_connected)
|
||||
switch_event = self.ledger.network.on_connected.first
|
||||
await node2.stop(True)
|
||||
# secondary down, but primary is ok, do not switch! (switches trigger new on_connected events)
|
||||
with self.assertRaises(asyncio.TimeoutError):
|
||||
await asyncio.wait_for(switch_event, timeout=1)
|
||||
|
||||
async def test_connection_drop_still_receives_events_after_reconnected(self):
|
||||
address1 = await self.account.receiving.get_or_create_usable_address()
|
||||
# disconnect and send a new tx, should reconnect and get it
|
||||
@@ -35,10 +56,11 @@ class ReconnectTests(IntegrationTestCase):
|
||||
# is it real? are we rich!? let me see this tx...
|
||||
d = self.ledger.network.get_transaction(sendtxid)
|
||||
# what's that smoke on my ethernet cable? oh no!
|
||||
master_client = self.ledger.network.client
|
||||
self.ledger.network.client.connection_lost(Exception())
|
||||
with self.assertRaises(asyncio.TimeoutError):
|
||||
await d
|
||||
self.assertIsNone(self.ledger.network.client.response_time) # response time unknown as it failed
|
||||
await d
|
||||
self.assertIsNone(master_client.response_time) # response time unknown as it failed
|
||||
# rich but offline? no way, no water, let's retry
|
||||
with self.assertRaisesRegex(ConnectionError, 'connection is not available'):
|
||||
await self.ledger.network.get_transaction(sendtxid)
|
||||
@@ -104,4 +126,4 @@ class ServerPickingTestCase(AsyncioTestCase):
|
||||
self.assertTrue(all([not session.is_closing() for session in network.session_pool.available_sessions]))
|
||||
# ensure we are connected to all of them after a while
|
||||
await asyncio.sleep(1)
|
||||
self.assertEqual(len(network.session_pool.available_sessions), 3)
|
||||
self.assertEqual(len(list(network.session_pool.available_sessions)), 3)
|
||||
@@ -1,6 +1,9 @@
|
||||
import logging
|
||||
import asyncio
|
||||
import random
|
||||
from itertools import chain
|
||||
from random import shuffle
|
||||
|
||||
from torba.testcase import IntegrationTestCase
|
||||
from torba.client.util import satoshis_to_coins, coins_to_satoshis
|
||||
|
||||
@@ -129,3 +132,48 @@ class BasicTransactionTests(IntegrationTestCase):
|
||||
self.assertEqual(tx.outputs[0].get_address(self.ledger), address2)
|
||||
self.assertEqual(tx.outputs[0].is_change, False)
|
||||
self.assertEqual(tx.outputs[1].is_change, True)
|
||||
|
||||
async def test_history_edge_cases(self):
|
||||
await self.assertBalance(self.account, '0.0')
|
||||
address = await self.account.receiving.get_or_create_usable_address()
|
||||
# evil trick: mempool is unsorted on real life, but same order between python instances. reproduce it
|
||||
original_summary = self.conductor.spv_node.server.mempool.transaction_summaries
|
||||
|
||||
async def random_summary(*args, **kwargs):
|
||||
summary = await original_summary(*args, **kwargs)
|
||||
if summary and len(summary) > 2:
|
||||
ordered = summary.copy()
|
||||
while summary == ordered:
|
||||
random.shuffle(summary)
|
||||
return summary
|
||||
self.conductor.spv_node.server.mempool.transaction_summaries = random_summary
|
||||
# 10 unconfirmed txs, all from blockchain wallet
|
||||
sends = list(self.blockchain.send_to_address(address, 10) for _ in range(10))
|
||||
# use batching to reduce issues with send_to_address on cli
|
||||
for batch in range(0, len(sends), 10):
|
||||
txids = await asyncio.gather(*sends[batch:batch + 10])
|
||||
await asyncio.wait([self.on_transaction_id(txid) for txid in txids])
|
||||
remote_status = await self.ledger.network.subscribe_address(address)
|
||||
self.assertTrue(await self.ledger.update_history(address, remote_status))
|
||||
# 20 unconfirmed txs, 10 from blockchain, 10 from local to local
|
||||
utxos = await self.account.get_utxos()
|
||||
txs = []
|
||||
for utxo in utxos:
|
||||
tx = await self.ledger.transaction_class.create(
|
||||
[self.ledger.transaction_class.input_class.spend(utxo)],
|
||||
[],
|
||||
[self.account], self.account
|
||||
)
|
||||
await self.broadcast(tx)
|
||||
txs.append(tx)
|
||||
await asyncio.wait([self.on_transaction_address(tx, address) for tx in txs], timeout=1)
|
||||
remote_status = await self.ledger.network.subscribe_address(address)
|
||||
self.assertTrue(await self.ledger.update_history(address, remote_status))
|
||||
# server history grows unordered
|
||||
txid = await self.blockchain.send_to_address(address, 1)
|
||||
await self.on_transaction_id(txid)
|
||||
self.assertTrue(await self.ledger.update_history(address, remote_status))
|
||||
self.assertEqual(21, len((await self.ledger.get_local_status_and_history(address))[1]))
|
||||
self.assertEqual(0, len(self.ledger._known_addresses_out_of_sync))
|
||||
# should be another test, but it would be too much to setup just for that and it affects sync
|
||||
self.assertIsNone(await self.ledger.network.retriable_call(self.ledger.network.get_transaction, '1'*64))
|
||||
@@ -1,5 +1,7 @@
|
||||
import unittest
|
||||
import sqlite3
|
||||
import tempfile
|
||||
import os
|
||||
|
||||
from torba.client.wallet import Wallet
|
||||
from torba.client.constants import COIN
|
||||
@@ -268,7 +270,6 @@ class TestQueries(AsyncioTestCase):
|
||||
self.assertEqual(len(tx.outputs), 1)
|
||||
last_tx = tx
|
||||
|
||||
|
||||
async def test_queries(self):
|
||||
self.assertEqual(0, await self.ledger.db.get_address_count())
|
||||
account1 = await self.create_account()
|
||||
@@ -354,3 +355,79 @@ class TestQueries(AsyncioTestCase):
|
||||
txs = await self.ledger.db.get_transactions(accounts=[account1, account2])
|
||||
self.assertEqual([0, 3, 2, 1], [tx.height for tx in txs])
|
||||
self.assertEqual([tx4.id, tx3.id, tx2.id, tx1.id], [tx.id for tx in txs])
|
||||
|
||||
|
||||
class TestUpgrade(AsyncioTestCase):
|
||||
|
||||
def setUp(self) -> None:
|
||||
self.path = tempfile.mktemp()
|
||||
|
||||
def tearDown(self) -> None:
|
||||
os.remove(self.path)
|
||||
|
||||
def get_version(self):
|
||||
with sqlite3.connect(self.path) as conn:
|
||||
versions = conn.execute('select version from version').fetchall()
|
||||
assert len(versions) == 1
|
||||
return versions[0][0]
|
||||
|
||||
def get_tables(self):
|
||||
with sqlite3.connect(self.path) as conn:
|
||||
sql = "SELECT name FROM sqlite_master WHERE type='table' ORDER BY name;"
|
||||
return [col[0] for col in conn.execute(sql).fetchall()]
|
||||
|
||||
def add_address(self, address):
|
||||
with sqlite3.connect(self.path) as conn:
|
||||
conn.execute("""
|
||||
INSERT INTO pubkey_address (address, account, chain, position, pubkey)
|
||||
VALUES (?, 'account1', 0, 0, 'pubkey blob')
|
||||
""", (address,))
|
||||
|
||||
def get_addresses(self):
|
||||
with sqlite3.connect(self.path) as conn:
|
||||
sql = "SELECT address FROM pubkey_address ORDER BY address;"
|
||||
return [col[0] for col in conn.execute(sql).fetchall()]
|
||||
|
||||
async def test_reset_on_version_change(self):
|
||||
self.ledger = ledger_class({
|
||||
'db': ledger_class.database_class(self.path),
|
||||
'headers': ledger_class.headers_class(':memory:'),
|
||||
})
|
||||
|
||||
# initial open, pre-version enabled db
|
||||
self.ledger.db.SCHEMA_VERSION = None
|
||||
self.assertEqual(self.get_tables(), [])
|
||||
await self.ledger.db.open()
|
||||
self.assertEqual(self.get_tables(), ['pubkey_address', 'tx', 'txi', 'txo'])
|
||||
self.assertEqual(self.get_addresses(), [])
|
||||
self.add_address('address1')
|
||||
await self.ledger.db.close()
|
||||
|
||||
# initial open after version enabled
|
||||
self.ledger.db.SCHEMA_VERSION = '1.0'
|
||||
await self.ledger.db.open()
|
||||
self.assertEqual(self.get_version(), '1.0')
|
||||
self.assertEqual(self.get_tables(), ['pubkey_address', 'tx', 'txi', 'txo', 'version'])
|
||||
self.assertEqual(self.get_addresses(), []) # address1 deleted during version upgrade
|
||||
self.add_address('address2')
|
||||
await self.ledger.db.close()
|
||||
|
||||
# nothing changes
|
||||
self.assertEqual(self.get_version(), '1.0')
|
||||
self.assertEqual(self.get_tables(), ['pubkey_address', 'tx', 'txi', 'txo', 'version'])
|
||||
await self.ledger.db.open()
|
||||
self.assertEqual(self.get_version(), '1.0')
|
||||
self.assertEqual(self.get_tables(), ['pubkey_address', 'tx', 'txi', 'txo', 'version'])
|
||||
self.assertEqual(self.get_addresses(), ['address2'])
|
||||
await self.ledger.db.close()
|
||||
|
||||
# upgrade version, database reset
|
||||
self.ledger.db.SCHEMA_VERSION = '1.1'
|
||||
self.ledger.db.CREATE_TABLES_QUERY += """
|
||||
create table if not exists foo (bar text);
|
||||
"""
|
||||
await self.ledger.db.open()
|
||||
self.assertEqual(self.get_version(), '1.1')
|
||||
self.assertEqual(self.get_tables(), ['foo', 'pubkey_address', 'tx', 'txi', 'txo', 'version'])
|
||||
self.assertEqual(self.get_addresses(), []) # all tables got reset
|
||||
await self.ledger.db.close()
|
||||
@@ -94,6 +94,17 @@ class BasicHeadersTests(BitcoinHeadersTestCase):
|
||||
await headers.connect(len(headers), remainder)
|
||||
self.assertEqual(headers.height, 32259)
|
||||
|
||||
async def test_bounds(self):
|
||||
headers = MainHeaders(':memory:')
|
||||
await headers.connect(0, self.get_bytes(block_bytes(3001)))
|
||||
self.assertEqual(headers.height, 3000)
|
||||
with self.assertRaises(IndexError):
|
||||
_ = headers[3001]
|
||||
with self.assertRaises(IndexError):
|
||||
_ = headers[-1]
|
||||
self.assertIsNotNone(headers[3000])
|
||||
self.assertIsNotNone(headers[0])
|
||||
|
||||
async def test_repair(self):
|
||||
headers = MainHeaders(':memory:')
|
||||
await headers.connect(0, self.get_bytes(block_bytes(3001)))
|
||||
|
||||
@@ -29,7 +29,7 @@ class MockNetwork:
|
||||
async def get_merkle(self, txid, height):
|
||||
return {'merkle': ['abcd01'], 'pos': 1}
|
||||
|
||||
async def get_transaction(self, tx_hash):
|
||||
async def get_transaction(self, tx_hash, _=None):
|
||||
self.get_transaction_called.append(tx_hash)
|
||||
return self.transaction[tx_hash]
|
||||
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
import logging
|
||||
import asyncio
|
||||
from asyncio import wrap_future
|
||||
from binascii import hexlify
|
||||
from concurrent.futures.thread import ThreadPoolExecutor
|
||||
|
||||
from typing import Tuple, List, Union, Callable, Any, Awaitable, Iterable
|
||||
from typing import Tuple, List, Union, Callable, Any, Awaitable, Iterable, Optional
|
||||
|
||||
import sqlite3
|
||||
|
||||
@@ -23,8 +22,10 @@ class AIOSQLite:
|
||||
|
||||
@classmethod
|
||||
async def connect(cls, path: Union[bytes, str], *args, **kwargs):
|
||||
def _connect():
|
||||
return sqlite3.connect(path, *args, **kwargs)
|
||||
db = cls()
|
||||
db.connection = await wrap_future(db.executor.submit(sqlite3.connect, path, *args, **kwargs))
|
||||
db.connection = await asyncio.get_event_loop().run_in_executor(db.executor, _connect)
|
||||
return db
|
||||
|
||||
async def close(self):
|
||||
@@ -38,25 +39,29 @@ class AIOSQLite:
|
||||
return asyncio.get_event_loop_policy().get_event_loop().call_later(0.01, __close, conn)
|
||||
|
||||
def executemany(self, sql: str, params: Iterable):
|
||||
def __executemany_in_a_transaction(conn: sqlite3.Connection, *args, **kwargs):
|
||||
return conn.executemany(*args, **kwargs)
|
||||
return self.run(__executemany_in_a_transaction, sql, params)
|
||||
params = params if params is not None else []
|
||||
# this fetchall is needed to prevent SQLITE_MISUSE
|
||||
return self.run(lambda conn: conn.executemany(sql, params).fetchall())
|
||||
|
||||
def executescript(self, script: str) -> Awaitable:
|
||||
return wrap_future(self.executor.submit(self.connection.executescript, script))
|
||||
return self.run(lambda conn: conn.executescript(script))
|
||||
|
||||
def execute_fetchall(self, sql: str, parameters: Iterable = None) -> Awaitable[Iterable[sqlite3.Row]]:
|
||||
parameters = parameters if parameters is not None else []
|
||||
def __fetchall(conn: sqlite3.Connection, *args, **kwargs):
|
||||
return conn.execute(*args, **kwargs).fetchall()
|
||||
return wrap_future(self.executor.submit(__fetchall, self.connection, sql, parameters))
|
||||
return self.run(lambda conn: conn.execute(sql, parameters).fetchall())
|
||||
|
||||
def execute_fetchone(self, sql: str, parameters: Iterable = None) -> Awaitable[Iterable[sqlite3.Row]]:
|
||||
parameters = parameters if parameters is not None else []
|
||||
return self.run(lambda conn: conn.execute(sql, parameters).fetchone())
|
||||
|
||||
def execute(self, sql: str, parameters: Iterable = None) -> Awaitable[sqlite3.Cursor]:
|
||||
parameters = parameters if parameters is not None else []
|
||||
return self.run(lambda conn, sql, parameters: conn.execute(sql, parameters), sql, parameters)
|
||||
return self.run(lambda conn: conn.execute(sql, parameters))
|
||||
|
||||
def run(self, fun, *args, **kwargs) -> Awaitable:
|
||||
return wrap_future(self.executor.submit(self.__run_transaction, fun, *args, **kwargs))
|
||||
return asyncio.get_event_loop().run_in_executor(
|
||||
self.executor, lambda: self.__run_transaction(fun, *args, **kwargs)
|
||||
)
|
||||
|
||||
def __run_transaction(self, fun: Callable[[sqlite3.Connection, Any, Any], Any], *args, **kwargs):
|
||||
self.connection.execute('begin')
|
||||
@@ -64,19 +69,20 @@ class AIOSQLite:
|
||||
result = fun(self.connection, *args, **kwargs) # type: ignore
|
||||
self.connection.commit()
|
||||
return result
|
||||
except (Exception, OSError): # as e:
|
||||
#log.exception('Error running transaction:', exc_info=e)
|
||||
except (Exception, OSError) as e:
|
||||
log.exception('Error running transaction:', exc_info=e)
|
||||
self.connection.rollback()
|
||||
log.warning("rolled back")
|
||||
raise
|
||||
|
||||
def run_with_foreign_keys_disabled(self, fun, *args, **kwargs) -> Awaitable:
|
||||
return wrap_future(
|
||||
self.executor.submit(self.__run_transaction_with_foreign_keys_disabled, fun, *args, **kwargs)
|
||||
return asyncio.get_event_loop().run_in_executor(
|
||||
self.executor, self.__run_transaction_with_foreign_keys_disabled, fun, args, kwargs
|
||||
)
|
||||
|
||||
def __run_transaction_with_foreign_keys_disabled(self,
|
||||
fun: Callable[[sqlite3.Connection, Any, Any], Any],
|
||||
*args, **kwargs):
|
||||
args, kwargs):
|
||||
foreign_keys_enabled, = self.connection.execute("pragma foreign_keys").fetchone()
|
||||
if not foreign_keys_enabled:
|
||||
raise sqlite3.IntegrityError("foreign keys are disabled, use `AIOSQLite.run` instead")
|
||||
@@ -210,9 +216,16 @@ def rows_to_dict(rows, fields):
|
||||
|
||||
class SQLiteMixin:
|
||||
|
||||
SCHEMA_VERSION: Optional[str] = None
|
||||
CREATE_TABLES_QUERY: str
|
||||
MAX_QUERY_VARIABLES = 900
|
||||
|
||||
CREATE_VERSION_TABLE = """
|
||||
create table if not exists version (
|
||||
version text
|
||||
);
|
||||
"""
|
||||
|
||||
def __init__(self, path):
|
||||
self._db_path = path
|
||||
self.db: AIOSQLite = None
|
||||
@@ -220,23 +233,40 @@ class SQLiteMixin:
|
||||
|
||||
async def open(self):
|
||||
log.info("connecting to database: %s", self._db_path)
|
||||
self.db = await AIOSQLite.connect(self._db_path)
|
||||
self.db = await AIOSQLite.connect(self._db_path, isolation_level=None)
|
||||
if self.SCHEMA_VERSION:
|
||||
tables = [t[0] for t in await self.db.execute_fetchall(
|
||||
"SELECT name FROM sqlite_master WHERE type='table';"
|
||||
)]
|
||||
if tables:
|
||||
if 'version' in tables:
|
||||
version = await self.db.execute_fetchone("SELECT version FROM version LIMIT 1;")
|
||||
if version == (self.SCHEMA_VERSION,):
|
||||
return
|
||||
await self.db.executescript('\n'.join(
|
||||
f"DROP TABLE {table};" for table in tables
|
||||
))
|
||||
await self.db.execute(self.CREATE_VERSION_TABLE)
|
||||
await self.db.execute("INSERT INTO version VALUES (?)", (self.SCHEMA_VERSION,))
|
||||
await self.db.executescript(self.CREATE_TABLES_QUERY)
|
||||
|
||||
async def close(self):
|
||||
await self.db.close()
|
||||
|
||||
@staticmethod
|
||||
def _insert_sql(table: str, data: dict, ignore_duplicate: bool = False) -> Tuple[str, List]:
|
||||
def _insert_sql(table: str, data: dict, ignore_duplicate: bool = False,
|
||||
replace: bool = False) -> Tuple[str, List]:
|
||||
columns, values = [], []
|
||||
for column, value in data.items():
|
||||
columns.append(column)
|
||||
values.append(value)
|
||||
or_ignore = ""
|
||||
policy = ""
|
||||
if ignore_duplicate:
|
||||
or_ignore = " OR IGNORE"
|
||||
policy = " OR IGNORE"
|
||||
if replace:
|
||||
policy = " OR REPLACE"
|
||||
sql = "INSERT{} INTO {} ({}) VALUES ({})".format(
|
||||
or_ignore, table, ', '.join(columns), ', '.join(['?'] * len(values))
|
||||
policy, table, ', '.join(columns), ', '.join(['?'] * len(values))
|
||||
)
|
||||
return sql, values
|
||||
|
||||
@@ -256,6 +286,8 @@ class SQLiteMixin:
|
||||
|
||||
class BaseDatabase(SQLiteMixin):
|
||||
|
||||
SCHEMA_VERSION = "1.0"
|
||||
|
||||
PRAGMAS = """
|
||||
pragma journal_mode=WAL;
|
||||
"""
|
||||
@@ -334,49 +366,59 @@ class BaseDatabase(SQLiteMixin):
|
||||
'script': sqlite3.Binary(txo.script.source)
|
||||
}
|
||||
|
||||
async def insert_transaction(self, tx):
|
||||
await self.db.execute(*self._insert_sql('tx', {
|
||||
@staticmethod
|
||||
def tx_to_row(tx):
|
||||
return {
|
||||
'txid': tx.id,
|
||||
'raw': sqlite3.Binary(tx.raw),
|
||||
'height': tx.height,
|
||||
'position': tx.position,
|
||||
'is_verified': tx.is_verified
|
||||
}))
|
||||
}
|
||||
|
||||
async def insert_transaction(self, tx):
|
||||
await self.db.execute(*self._insert_sql('tx', self.tx_to_row(tx)))
|
||||
|
||||
async def update_transaction(self, tx):
|
||||
await self.db.execute(*self._update_sql("tx", {
|
||||
'height': tx.height, 'position': tx.position, 'is_verified': tx.is_verified
|
||||
}, 'txid = ?', (tx.id,)))
|
||||
|
||||
def _transaction_io(self, conn: sqlite3.Connection, tx: BaseTransaction, address, txhash, history):
|
||||
conn.execute(*self._insert_sql('tx', self.tx_to_row(tx), replace=True))
|
||||
|
||||
for txo in tx.outputs:
|
||||
if txo.script.is_pay_pubkey_hash and txo.script.values['pubkey_hash'] == txhash:
|
||||
conn.execute(*self._insert_sql(
|
||||
"txo", self.txo_to_row(tx, address, txo), ignore_duplicate=True
|
||||
))
|
||||
elif txo.script.is_pay_script_hash:
|
||||
# TODO: implement script hash payments
|
||||
log.warning('Database.save_transaction_io: pay script hash is not implemented!')
|
||||
|
||||
for txi in tx.inputs:
|
||||
if txi.txo_ref.txo is not None:
|
||||
txo = txi.txo_ref.txo
|
||||
if txo.get_address(self.ledger) == address:
|
||||
conn.execute(*self._insert_sql("txi", {
|
||||
'txid': tx.id,
|
||||
'txoid': txo.id,
|
||||
'address': address,
|
||||
}, ignore_duplicate=True))
|
||||
|
||||
conn.execute(
|
||||
"UPDATE pubkey_address SET history = ?, used_times = ? WHERE address = ?",
|
||||
(history, history.count(':') // 2, address)
|
||||
)
|
||||
|
||||
def save_transaction_io(self, tx: BaseTransaction, address, txhash, history):
|
||||
return self.db.run(self._transaction_io, tx, address, txhash, history)
|
||||
|
||||
def _transaction(conn: sqlite3.Connection, tx: BaseTransaction, address, txhash, history):
|
||||
|
||||
for txo in tx.outputs:
|
||||
if txo.script.is_pay_pubkey_hash and txo.script.values['pubkey_hash'] == txhash:
|
||||
conn.execute(*self._insert_sql(
|
||||
"txo", self.txo_to_row(tx, address, txo), ignore_duplicate=True
|
||||
))
|
||||
elif txo.script.is_pay_script_hash:
|
||||
# TODO: implement script hash payments
|
||||
log.warning('Database.save_transaction_io: pay script hash is not implemented!')
|
||||
|
||||
for txi in tx.inputs:
|
||||
if txi.txo_ref.txo is not None:
|
||||
txo = txi.txo_ref.txo
|
||||
if txo.get_address(self.ledger) == address:
|
||||
conn.execute(*self._insert_sql("txi", {
|
||||
'txid': tx.id,
|
||||
'txoid': txo.id,
|
||||
'address': address,
|
||||
}, ignore_duplicate=True))
|
||||
|
||||
conn.execute(
|
||||
"UPDATE pubkey_address SET history = ?, used_times = ? WHERE address = ?",
|
||||
(history, history.count(':')//2, address)
|
||||
)
|
||||
|
||||
return self.db.run(_transaction, tx, address, txhash, history)
|
||||
def save_transaction_io_batch(self, txs: Iterable[BaseTransaction], address, txhash, history):
|
||||
def __many(conn):
|
||||
for tx in txs:
|
||||
self._transaction_io(conn, tx, address, txhash, history)
|
||||
return self.db.run(__many)
|
||||
|
||||
async def reserve_outputs(self, txos, is_reserved=True):
|
||||
txoids = ((is_reserved, txo.id) for txo in txos)
|
||||
@@ -569,9 +611,11 @@ class BaseDatabase(SQLiteMixin):
|
||||
async def add_keys(self, account, chain, keys):
|
||||
await self.db.executemany(
|
||||
"insert into pubkey_address (address, account, chain, position, pubkey) values (?, ?, ?, ?, ?)",
|
||||
((pubkey.address, account.public_key.address, chain,
|
||||
position, sqlite3.Binary(pubkey.pubkey_bytes))
|
||||
for position, pubkey in keys)
|
||||
(
|
||||
(pubkey.address, account.public_key.address, chain, position,
|
||||
sqlite3.Binary(pubkey.pubkey_bytes))
|
||||
for position, pubkey in keys
|
||||
)
|
||||
)
|
||||
|
||||
async def _set_address_history(self, address, history):
|
||||
|
||||
@@ -70,8 +70,10 @@ class BaseHeaders:
|
||||
return True
|
||||
|
||||
def __getitem__(self, height) -> dict:
|
||||
assert not isinstance(height, slice), \
|
||||
"Slicing of header chain has not been implemented yet."
|
||||
if isinstance(height, slice):
|
||||
raise NotImplementedError("Slicing of header chain has not been implemented yet.")
|
||||
if not 0 <= height <= self.height:
|
||||
raise IndexError(f"{height} is out of bounds, current height: {self.height}")
|
||||
return self.deserialize(height, self.get_raw_header(height))
|
||||
|
||||
def get_raw_header(self, height) -> bytes:
|
||||
|
||||
@@ -10,6 +10,7 @@ from operator import itemgetter
|
||||
from collections import namedtuple
|
||||
|
||||
import pylru
|
||||
from torba.client.basetransaction import BaseTransaction
|
||||
from torba.tasks import TaskGroup
|
||||
from torba.client import baseaccount, basenetwork, basetransaction
|
||||
from torba.client.basedatabase import BaseDatabase
|
||||
@@ -142,6 +143,7 @@ class BaseLedger(metaclass=LedgerRegistry):
|
||||
self._address_update_locks: Dict[str, asyncio.Lock] = {}
|
||||
|
||||
self.coin_selection_strategy = None
|
||||
self._known_addresses_out_of_sync = set()
|
||||
|
||||
@classmethod
|
||||
def get_id(cls):
|
||||
@@ -228,6 +230,8 @@ class BaseLedger(metaclass=LedgerRegistry):
|
||||
return self.release_outputs([txi.txo_ref.txo for txi in tx.inputs])
|
||||
|
||||
def constraint_account_or_all(self, constraints):
|
||||
if 'accounts' in constraints:
|
||||
return
|
||||
account = constraints.pop('account', None)
|
||||
if account:
|
||||
constraints['accounts'] = [account]
|
||||
@@ -250,9 +254,10 @@ class BaseLedger(metaclass=LedgerRegistry):
|
||||
self.constraint_account_or_all(constraints)
|
||||
return self.db.get_transaction_count(**constraints)
|
||||
|
||||
async def get_local_status_and_history(self, address):
|
||||
address_details = await self.db.get_address(address=address)
|
||||
history = address_details['history'] or ''
|
||||
async def get_local_status_and_history(self, address, history=None):
|
||||
if not history:
|
||||
address_details = await self.db.get_address(address=address)
|
||||
history = address_details['history'] or ''
|
||||
parts = history.split(':')[:-1]
|
||||
return (
|
||||
hexlify(sha256(history.encode())).decode() if history else None,
|
||||
@@ -284,7 +289,7 @@ class BaseLedger(metaclass=LedgerRegistry):
|
||||
await self.join_network()
|
||||
self.network.on_connected.listen(self.join_network)
|
||||
|
||||
async def join_network(self, *args):
|
||||
async def join_network(self, *_):
|
||||
log.info("Subscribing and updating accounts.")
|
||||
async with self._header_processing_lock:
|
||||
await self.update_headers()
|
||||
@@ -395,9 +400,13 @@ class BaseLedger(metaclass=LedgerRegistry):
|
||||
|
||||
async def subscribe_addresses(self, address_manager: baseaccount.AddressManager, addresses: List[str]):
|
||||
if self.network.is_connected and addresses:
|
||||
async for address, remote_status in self.network.subscribe_address(*addresses):
|
||||
# subscribe isnt a retriable call as it happens right after a connection is made
|
||||
self._update_tasks.add(self.update_history(address, remote_status, address_manager))
|
||||
await asyncio.wait([
|
||||
self.subscribe_address(address_manager, address) for address in addresses
|
||||
])
|
||||
|
||||
async def subscribe_address(self, address_manager: baseaccount.AddressManager, address: str):
|
||||
remote_status = await self.network.subscribe_address(address)
|
||||
self._update_tasks.add(self.update_history(address, remote_status, address_manager))
|
||||
|
||||
def process_status_update(self, update):
|
||||
address, remote_status = update
|
||||
@@ -407,24 +416,31 @@ class BaseLedger(metaclass=LedgerRegistry):
|
||||
address_manager: baseaccount.AddressManager = None):
|
||||
|
||||
async with self._address_update_locks.setdefault(address, asyncio.Lock()):
|
||||
self._known_addresses_out_of_sync.discard(address)
|
||||
|
||||
local_status, local_history = await self.get_local_status_and_history(address)
|
||||
|
||||
if local_status == remote_status:
|
||||
return
|
||||
return True
|
||||
|
||||
remote_history = await self.network.retriable_call(self.network.get_history, address)
|
||||
remote_history = list(map(itemgetter('tx_hash', 'height'), remote_history))
|
||||
we_need = set(remote_history) - set(local_history)
|
||||
if not we_need:
|
||||
return True
|
||||
|
||||
cache_tasks = []
|
||||
cache_tasks: List[asyncio.Future[BaseTransaction]] = []
|
||||
synced_history = StringIO()
|
||||
for i, (txid, remote_height) in enumerate(map(itemgetter('tx_hash', 'height'), remote_history)):
|
||||
if i < len(local_history) and local_history[i] == (txid, remote_height):
|
||||
for i, (txid, remote_height) in enumerate(remote_history):
|
||||
if i < len(local_history) and local_history[i] == (txid, remote_height) and not cache_tasks:
|
||||
synced_history.write(f'{txid}:{remote_height}:')
|
||||
else:
|
||||
check_local = (txid, remote_height) not in we_need
|
||||
cache_tasks.append(asyncio.ensure_future(
|
||||
self.cache_transaction(txid, remote_height)
|
||||
self.cache_transaction(txid, remote_height, check_local=check_local)
|
||||
))
|
||||
|
||||
synced_txs = []
|
||||
for task in cache_tasks:
|
||||
tx = await task
|
||||
|
||||
@@ -453,12 +469,15 @@ class BaseLedger(metaclass=LedgerRegistry):
|
||||
txi.txo_ref = referenced_txo.ref
|
||||
|
||||
synced_history.write(f'{tx.id}:{tx.height}:')
|
||||
synced_txs.append(tx)
|
||||
|
||||
await self.db.save_transaction_io(
|
||||
tx, address, self.address_to_hash160(address), synced_history.getvalue()
|
||||
)
|
||||
|
||||
await self._on_transaction_controller.add(TransactionEvent(address, tx))
|
||||
await self.db.save_transaction_io_batch(
|
||||
synced_txs, address, self.address_to_hash160(address), synced_history.getvalue()
|
||||
)
|
||||
await asyncio.wait([
|
||||
self._on_transaction_controller.add(TransactionEvent(address, tx))
|
||||
for tx in synced_txs
|
||||
])
|
||||
|
||||
if address_manager is None:
|
||||
address_manager = await self.get_address_manager_for_address(address)
|
||||
@@ -466,7 +485,23 @@ class BaseLedger(metaclass=LedgerRegistry):
|
||||
if address_manager is not None:
|
||||
await address_manager.ensure_address_gap()
|
||||
|
||||
async def cache_transaction(self, txid, remote_height):
|
||||
local_status, local_history = \
|
||||
await self.get_local_status_and_history(address, synced_history.getvalue())
|
||||
if local_status != remote_status:
|
||||
if local_history == remote_history:
|
||||
return True
|
||||
log.warning(
|
||||
"Wallet is out of sync after syncing. Remote: %s with %d items, local: %s with %d items",
|
||||
remote_status, len(remote_history), local_status, len(local_history)
|
||||
)
|
||||
log.warning("local: %s", local_history)
|
||||
log.warning("remote: %s", remote_history)
|
||||
self._known_addresses_out_of_sync.add(address)
|
||||
return False
|
||||
else:
|
||||
return True
|
||||
|
||||
async def cache_transaction(self, txid, remote_height, check_local=True):
|
||||
cache_item = self._tx_cache.get(txid)
|
||||
if cache_item is None:
|
||||
cache_item = self._tx_cache[txid] = TransactionCacheItem()
|
||||
@@ -479,33 +514,26 @@ class BaseLedger(metaclass=LedgerRegistry):
|
||||
|
||||
tx = cache_item.tx
|
||||
|
||||
if tx is None:
|
||||
if tx is None and check_local:
|
||||
# check local db
|
||||
tx = cache_item.tx = await self.db.get_transaction(txid=txid)
|
||||
|
||||
if tx is None:
|
||||
# fetch from network
|
||||
_raw = await self.network.retriable_call(self.network.get_transaction, txid)
|
||||
_raw = await self.network.retriable_call(self.network.get_transaction, txid, remote_height)
|
||||
if _raw:
|
||||
tx = self.transaction_class(unhexlify(_raw))
|
||||
await self.maybe_verify_transaction(tx, remote_height)
|
||||
await self.db.insert_transaction(tx)
|
||||
cache_item.tx = tx # make sure it's saved before caching it
|
||||
return tx
|
||||
|
||||
if tx is None:
|
||||
raise ValueError(f'Transaction {txid} was not in database and not on network.')
|
||||
|
||||
if remote_height > 0 and not tx.is_verified:
|
||||
# tx from cache / db is not up-to-date
|
||||
await self.maybe_verify_transaction(tx, remote_height)
|
||||
await self.db.update_transaction(tx)
|
||||
|
||||
await self.maybe_verify_transaction(tx, remote_height)
|
||||
return tx
|
||||
|
||||
async def maybe_verify_transaction(self, tx, remote_height):
|
||||
tx.height = remote_height
|
||||
if 0 < remote_height <= len(self.headers):
|
||||
if 0 < remote_height < len(self.headers):
|
||||
merkle = await self.network.retriable_call(self.network.get_merkle, tx.id, remote_height)
|
||||
merkle_root = self.get_root_of_merkle_tree(merkle['merkle'], merkle['pos'], tx.hash)
|
||||
header = self.headers[remote_height]
|
||||
|
||||
@@ -4,7 +4,7 @@ from operator import itemgetter
|
||||
from typing import Dict, Optional, Tuple
|
||||
from time import perf_counter
|
||||
|
||||
from torba.rpc import RPCSession as BaseClientSession, Connector, RPCError
|
||||
from torba.rpc import RPCSession as BaseClientSession, Connector, RPCError, ProtocolError
|
||||
|
||||
from torba import __version__
|
||||
from torba.stream import StreamController
|
||||
@@ -29,10 +29,12 @@ class ClientSession(BaseClientSession):
|
||||
self.pending_amount = 0
|
||||
self._on_connect_cb = on_connect_callback or (lambda: None)
|
||||
self.trigger_urgent_reconnect = asyncio.Event()
|
||||
# one request per second of timeout, conservative default
|
||||
self._semaphore = asyncio.Semaphore(self.timeout * 2)
|
||||
|
||||
@property
|
||||
def available(self):
|
||||
return not self.is_closing() and self._can_send.is_set() and self.response_time is not None
|
||||
return not self.is_closing() and self.response_time is not None
|
||||
|
||||
@property
|
||||
def server_address_and_port(self) -> Optional[Tuple[str, int]]:
|
||||
@@ -40,11 +42,12 @@ class ClientSession(BaseClientSession):
|
||||
return None
|
||||
return self.transport.get_extra_info('peername')
|
||||
|
||||
async def send_timed_server_version_request(self, args=()):
|
||||
async def send_timed_server_version_request(self, args=(), timeout=None):
|
||||
timeout = timeout or self.timeout
|
||||
log.debug("send version request to %s:%i", *self.server)
|
||||
start = perf_counter()
|
||||
result = await asyncio.wait_for(
|
||||
super().send_request('server.version', args), timeout=self.timeout
|
||||
super().send_request('server.version', args), timeout=timeout
|
||||
)
|
||||
current_response_time = perf_counter() - start
|
||||
response_sum = (self.response_time or 0) * self._response_samples + current_response_time
|
||||
@@ -54,23 +57,45 @@ class ClientSession(BaseClientSession):
|
||||
|
||||
async def send_request(self, method, args=()):
|
||||
self.pending_amount += 1
|
||||
async with self._semaphore:
|
||||
return await self._send_request(method, args)
|
||||
|
||||
async def _send_request(self, method, args=()):
|
||||
log.debug("send %s to %s:%i", method, *self.server)
|
||||
try:
|
||||
if method == 'server.version':
|
||||
return await self.send_timed_server_version_request(args)
|
||||
return await asyncio.wait_for(
|
||||
super().send_request(method, args), timeout=self.timeout
|
||||
)
|
||||
except RPCError as e:
|
||||
reply = await self.send_timed_server_version_request(args, self.timeout)
|
||||
else:
|
||||
reply = await asyncio.wait_for(
|
||||
super().send_request(method, args), timeout=self.timeout
|
||||
)
|
||||
log.debug("got reply for %s from %s:%i", method, *self.server)
|
||||
return reply
|
||||
except (RPCError, ProtocolError) as e:
|
||||
if str(e).find('.*no such .*transaction.*'):
|
||||
# shouldnt the server return none instead?
|
||||
return None
|
||||
log.warning("Wallet server (%s:%i) returned an error. Code: %s Message: %s",
|
||||
*self.server, *e.args)
|
||||
raise e
|
||||
except ConnectionError:
|
||||
log.warning("connection to %s:%i lost", *self.server)
|
||||
self.synchronous_close()
|
||||
raise
|
||||
except asyncio.TimeoutError:
|
||||
log.info("timeout sending %s to %s:%i", method, *self.server)
|
||||
raise
|
||||
except asyncio.CancelledError:
|
||||
log.info("cancelled sending %s to %s:%i", method, *self.server)
|
||||
self.synchronous_close()
|
||||
raise
|
||||
finally:
|
||||
self.pending_amount -= 1
|
||||
|
||||
async def ensure_session(self):
|
||||
# Handles reconnecting and maintaining a session alive
|
||||
# TODO: change to 'ping' on newer protocol (above 1.2)
|
||||
retry_delay = default_delay = 0.1
|
||||
retry_delay = default_delay = 1.0
|
||||
while True:
|
||||
try:
|
||||
if self.is_closing():
|
||||
@@ -83,19 +108,18 @@ class ClientSession(BaseClientSession):
|
||||
except (asyncio.TimeoutError, OSError):
|
||||
await self.close()
|
||||
retry_delay = min(60, retry_delay * 2)
|
||||
log.warning("Wallet server timeout (retry in %s seconds): %s:%d", retry_delay, *self.server)
|
||||
log.debug("Wallet server timeout (retry in %s seconds): %s:%d", retry_delay, *self.server)
|
||||
try:
|
||||
await asyncio.wait_for(self.trigger_urgent_reconnect.wait(), timeout=retry_delay)
|
||||
except asyncio.TimeoutError:
|
||||
pass
|
||||
except asyncio.CancelledError:
|
||||
self.synchronous_close()
|
||||
raise
|
||||
finally:
|
||||
self.trigger_urgent_reconnect.clear()
|
||||
|
||||
def ensure_server_version(self, required='1.2'):
|
||||
return self.send_request('server.version', [__version__, required])
|
||||
async def ensure_server_version(self, required='1.2', timeout=3):
|
||||
return await asyncio.wait_for(
|
||||
self.send_request('server.version', [__version__, required]), timeout=timeout
|
||||
)
|
||||
|
||||
async def create_connection(self, timeout=6):
|
||||
connector = Connector(lambda: self, *self.server)
|
||||
@@ -120,10 +144,10 @@ class ClientSession(BaseClientSession):
|
||||
class BaseNetwork:
|
||||
|
||||
def __init__(self, ledger):
|
||||
self.switch_event = asyncio.Event()
|
||||
self.config = ledger.config
|
||||
self.session_pool = SessionPool(network=self, timeout=self.config.get('connect_timeout', 6))
|
||||
self.client: Optional[ClientSession] = None
|
||||
self._switch_task: Optional[asyncio.Task] = None
|
||||
self.running = False
|
||||
self.remote_height: int = 0
|
||||
|
||||
@@ -141,36 +165,42 @@ class BaseNetwork:
|
||||
'blockchain.address.subscribe': self._on_status_controller,
|
||||
}
|
||||
|
||||
async def switch_forever(self):
|
||||
while self.running:
|
||||
if self.is_connected:
|
||||
await self.client.on_disconnected.first
|
||||
self.client = None
|
||||
continue
|
||||
self.client = await self.session_pool.wait_for_fastest_session()
|
||||
log.info("Switching to SPV wallet server: %s:%d", *self.client.server)
|
||||
self._on_connected_controller.add(True)
|
||||
try:
|
||||
self._update_remote_height((await self.subscribe_headers(),))
|
||||
log.info("Subscribed to headers: %s:%d", *self.client.server)
|
||||
except (asyncio.TimeoutError, ConnectionError):
|
||||
log.info("Switching to %s:%d timed out, closing and retrying.", *self.client.server)
|
||||
self.client.synchronous_close()
|
||||
self.client = None
|
||||
|
||||
async def start(self):
|
||||
self.running = True
|
||||
self._switch_task = asyncio.ensure_future(self.switch_forever())
|
||||
self.session_pool.start(self.config['default_servers'])
|
||||
self.on_header.listen(self._update_remote_height)
|
||||
while self.running:
|
||||
try:
|
||||
self.client = await self.session_pool.wait_for_fastest_session()
|
||||
self._update_remote_height((await self.subscribe_headers(),))
|
||||
log.info("Switching to SPV wallet server: %s:%d", *self.client.server)
|
||||
self._on_connected_controller.add(True)
|
||||
self.client.on_disconnected.listen(lambda _: self.switch_event.set())
|
||||
await self.switch_event.wait()
|
||||
self.switch_event.clear()
|
||||
except asyncio.CancelledError:
|
||||
await self.stop()
|
||||
raise
|
||||
except asyncio.TimeoutError:
|
||||
pass
|
||||
|
||||
async def stop(self):
|
||||
self.running = False
|
||||
self.session_pool.stop()
|
||||
if self.running:
|
||||
self.running = False
|
||||
self._switch_task.cancel()
|
||||
self.session_pool.stop()
|
||||
|
||||
@property
|
||||
def is_connected(self):
|
||||
return self.client and not self.client.is_closing()
|
||||
|
||||
def rpc(self, list_or_method, args, session=None):
|
||||
session = session or self.session_pool.fastest_session
|
||||
if session:
|
||||
def rpc(self, list_or_method, args, restricted=True):
|
||||
session = self.client if restricted else self.session_pool.fastest_session
|
||||
if session and not session.is_closing():
|
||||
return session.send_request(list_or_method, args)
|
||||
else:
|
||||
self.session_pool.trigger_nodelay_connect()
|
||||
@@ -178,46 +208,55 @@ class BaseNetwork:
|
||||
|
||||
async def retriable_call(self, function, *args, **kwargs):
|
||||
while self.running:
|
||||
if not self.is_connected:
|
||||
log.warning("Wallet server unavailable, waiting for it to come back and retry.")
|
||||
await self.on_connected.first
|
||||
await self.session_pool.wait_for_fastest_session()
|
||||
try:
|
||||
return await function(*args, **kwargs)
|
||||
except asyncio.TimeoutError:
|
||||
log.warning("Wallet server call timed out, retrying.")
|
||||
except ConnectionError:
|
||||
if not self.is_connected and self.running:
|
||||
log.warning("Wallet server unavailable, waiting for it to come back and retry.")
|
||||
await self.on_connected.first
|
||||
pass
|
||||
raise asyncio.CancelledError() # if we got here, we are shutting down
|
||||
|
||||
def _update_remote_height(self, header_args):
|
||||
self.remote_height = header_args[0]["height"]
|
||||
|
||||
def get_history(self, address):
|
||||
return self.rpc('blockchain.address.get_history', [address])
|
||||
def get_transaction(self, tx_hash, known_height=None):
|
||||
# use any server if its old, otherwise restrict to who gave us the history
|
||||
restricted = not known_height or 0 > known_height > self.remote_height - 10
|
||||
return self.rpc('blockchain.transaction.get', [tx_hash], restricted)
|
||||
|
||||
def get_transaction(self, tx_hash):
|
||||
return self.rpc('blockchain.transaction.get', [tx_hash])
|
||||
|
||||
def get_transaction_height(self, tx_hash):
|
||||
return self.rpc('blockchain.transaction.get_height', [tx_hash])
|
||||
def get_transaction_height(self, tx_hash, known_height=None):
|
||||
restricted = not known_height or 0 > known_height > self.remote_height - 10
|
||||
return self.rpc('blockchain.transaction.get_height', [tx_hash], restricted)
|
||||
|
||||
def get_merkle(self, tx_hash, height):
|
||||
return self.rpc('blockchain.transaction.get_merkle', [tx_hash, height])
|
||||
restricted = 0 > height > self.remote_height - 10
|
||||
return self.rpc('blockchain.transaction.get_merkle', [tx_hash, height], restricted)
|
||||
|
||||
def get_headers(self, height, count=10000):
|
||||
return self.rpc('blockchain.block.headers', [height, count])
|
||||
|
||||
# --- Subscribes and broadcasts are always aimed towards the master client directly
|
||||
# --- Subscribes, history and broadcasts are always aimed towards the master client directly
|
||||
def get_history(self, address):
|
||||
return self.rpc('blockchain.address.get_history', [address], True)
|
||||
|
||||
def broadcast(self, raw_transaction):
|
||||
return self.rpc('blockchain.transaction.broadcast', [raw_transaction], session=self.client)
|
||||
return self.rpc('blockchain.transaction.broadcast', [raw_transaction], True)
|
||||
|
||||
def subscribe_headers(self):
|
||||
return self.rpc('blockchain.headers.subscribe', [True], session=self.client)
|
||||
return self.rpc('blockchain.headers.subscribe', [True], True)
|
||||
|
||||
async def subscribe_address(self, *addresses):
|
||||
async with self.client.send_batch() as batch:
|
||||
for address in addresses:
|
||||
batch.add_request('blockchain.address.subscribe', [address])
|
||||
for address, status in zip(addresses, batch.results):
|
||||
yield address, status
|
||||
async def subscribe_address(self, address):
|
||||
try:
|
||||
return await self.rpc('blockchain.address.subscribe', [address], True)
|
||||
except asyncio.TimeoutError:
|
||||
# abort and cancel, we cant lose a subscription, it will happen again on reconnect
|
||||
if self.client:
|
||||
self.client.abort()
|
||||
raise asyncio.CancelledError()
|
||||
|
||||
|
||||
class SessionPool:
|
||||
@@ -234,11 +273,11 @@ class SessionPool:
|
||||
|
||||
@property
|
||||
def available_sessions(self):
|
||||
return [session for session in self.sessions if session.available]
|
||||
return (session for session in self.sessions if session.available)
|
||||
|
||||
@property
|
||||
def fastest_session(self):
|
||||
if not self.available_sessions:
|
||||
if not self.online:
|
||||
return None
|
||||
return min(
|
||||
[((session.response_time + session.connection_latency) * (session.pending_amount + 1), session)
|
||||
@@ -258,8 +297,8 @@ class SessionPool:
|
||||
if already_connected:
|
||||
self.sessions.pop(session).cancel()
|
||||
session.synchronous_close()
|
||||
log.info("wallet server %s resolves to the same server as %s, rechecking in an hour",
|
||||
session.server[0], already_connected.server[0])
|
||||
log.debug("wallet server %s resolves to the same server as %s, rechecking in an hour",
|
||||
session.server[0], already_connected.server[0])
|
||||
loop.call_later(3600, self._connect_session, session.server)
|
||||
return
|
||||
self.new_connection_event.set()
|
||||
@@ -289,8 +328,9 @@ class SessionPool:
|
||||
self._connect_session(server)
|
||||
|
||||
def stop(self):
|
||||
for task in self.sessions.values():
|
||||
for session, task in self.sessions.items():
|
||||
task.cancel()
|
||||
session.synchronous_close()
|
||||
self.sessions.clear()
|
||||
|
||||
def ensure_connections(self):
|
||||
|
||||
@@ -190,14 +190,15 @@ class WalletNode:
|
||||
|
||||
class SPVNode:
|
||||
|
||||
def __init__(self, coin_class):
|
||||
def __init__(self, coin_class, node_number=1):
|
||||
self.coin_class = coin_class
|
||||
self.controller = None
|
||||
self.data_path = None
|
||||
self.server = None
|
||||
self.hostname = 'localhost'
|
||||
self.port = 50001 + 1 # avoid conflict with default daemon
|
||||
self.port = 50001 + node_number # avoid conflict with default daemon
|
||||
self.session_timeout = 600
|
||||
self.rpc_port = '0' # disabled by default
|
||||
|
||||
async def start(self, blockchain_node: 'BlockchainNode'):
|
||||
self.data_path = tempfile.mkdtemp()
|
||||
@@ -210,6 +211,7 @@ class SPVNode:
|
||||
'SESSION_TIMEOUT': str(self.session_timeout),
|
||||
'MAX_QUERY_WORKERS': '0',
|
||||
'INDIVIDUAL_TAG_INDEXES': '',
|
||||
'RPC_PORT': self.rpc_port
|
||||
}
|
||||
# TODO: don't use os.environ
|
||||
os.environ.update(conf)
|
||||
|
||||
@@ -10,7 +10,8 @@ def get_argument_parser():
|
||||
parser = argparse.ArgumentParser(
|
||||
prog="torba-server"
|
||||
)
|
||||
parser.add_argument("spvserver", type=str, help="Python class path to SPV server implementation.")
|
||||
parser.add_argument("spvserver", type=str, help="Python class path to SPV server implementation.",
|
||||
nargs="?", default="lbry.wallet.server.coin.LBC")
|
||||
return parser
|
||||
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@ import time
|
||||
from asyncio import sleep
|
||||
from bisect import bisect_right
|
||||
from collections import namedtuple
|
||||
from functools import partial
|
||||
from glob import glob
|
||||
from struct import pack, unpack
|
||||
|
||||
@@ -72,9 +73,8 @@ class DB:
|
||||
self.header_len = self.dynamic_header_len
|
||||
|
||||
self.logger.info(f'switching current directory to {env.db_dir}')
|
||||
os.chdir(env.db_dir)
|
||||
|
||||
self.db_class = db_class(self.env.db_engine)
|
||||
self.db_class = db_class(env.db_dir, self.env.db_engine)
|
||||
self.history = History()
|
||||
self.utxo_db = None
|
||||
self.tx_counts = None
|
||||
@@ -86,12 +86,13 @@ class DB:
|
||||
self.merkle = Merkle()
|
||||
self.header_mc = MerkleCache(self.merkle, self.fs_block_hashes)
|
||||
|
||||
self.headers_file = util.LogicalFile('meta/headers', 2, 16000000)
|
||||
self.tx_counts_file = util.LogicalFile('meta/txcounts', 2, 2000000)
|
||||
self.hashes_file = util.LogicalFile('meta/hashes', 4, 16000000)
|
||||
path = partial(os.path.join, self.env.db_dir)
|
||||
self.headers_file = util.LogicalFile(path('meta/headers'), 2, 16000000)
|
||||
self.tx_counts_file = util.LogicalFile(path('meta/txcounts'), 2, 2000000)
|
||||
self.hashes_file = util.LogicalFile(path('meta/hashes'), 4, 16000000)
|
||||
if not self.coin.STATIC_BLOCK_HEADERS:
|
||||
self.headers_offsets_file = util.LogicalFile(
|
||||
'meta/headers_offsets', 2, 16000000)
|
||||
path('meta/headers_offsets'), 2, 16000000)
|
||||
|
||||
async def _read_tx_counts(self):
|
||||
if self.tx_counts is not None:
|
||||
@@ -115,8 +116,9 @@ class DB:
|
||||
if self.utxo_db.is_new:
|
||||
self.logger.info('created new database')
|
||||
self.logger.info('creating metadata directory')
|
||||
os.mkdir('meta')
|
||||
with util.open_file('COIN', create=True) as f:
|
||||
os.mkdir(os.path.join(self.env.db_dir, 'meta'))
|
||||
coin_path = os.path.join(self.env.db_dir, 'meta', 'COIN')
|
||||
with util.open_file(coin_path, create=True) as f:
|
||||
f.write(f'ElectrumX databases and metadata for '
|
||||
f'{self.coin.NAME} {self.coin.NET}'.encode())
|
||||
if not self.coin.STATIC_BLOCK_HEADERS:
|
||||
@@ -474,7 +476,7 @@ class DB:
|
||||
return 'meta/block'
|
||||
|
||||
def raw_block_path(self, height):
|
||||
return f'{self.raw_block_prefix()}{height:d}'
|
||||
return os.path.join(self.env.db_dir, f'{self.raw_block_prefix()}{height:d}')
|
||||
|
||||
def read_raw_block(self, height):
|
||||
"""Returns a raw block read from disk. Raises FileNotFoundError
|
||||
|
||||
@@ -13,20 +13,21 @@ from functools import partial
|
||||
from torba.server import util
|
||||
|
||||
|
||||
def db_class(name):
|
||||
def db_class(db_dir, name):
|
||||
"""Returns a DB engine class."""
|
||||
for db_class in util.subclasses(Storage):
|
||||
if db_class.__name__.lower() == name.lower():
|
||||
db_class.import_module()
|
||||
return db_class
|
||||
return partial(db_class, db_dir)
|
||||
raise RuntimeError('unrecognised DB engine "{}"'.format(name))
|
||||
|
||||
|
||||
class Storage:
|
||||
"""Abstract base class of the DB backend abstraction."""
|
||||
|
||||
def __init__(self, name, for_sync):
|
||||
self.is_new = not os.path.exists(name)
|
||||
def __init__(self, db_dir, name, for_sync):
|
||||
self.db_dir = db_dir
|
||||
self.is_new = not os.path.exists(os.path.join(db_dir, name))
|
||||
self.for_sync = for_sync or self.is_new
|
||||
self.open(name, create=self.is_new)
|
||||
|
||||
@@ -78,8 +79,9 @@ class LevelDB(Storage):
|
||||
|
||||
def open(self, name, create):
|
||||
mof = 512 if self.for_sync else 128
|
||||
path = os.path.join(self.db_dir, name)
|
||||
# Use snappy compression (the default)
|
||||
self.db = self.module.DB(name, create_if_missing=create,
|
||||
self.db = self.module.DB(path, create_if_missing=create,
|
||||
max_open_files=mof)
|
||||
self.close = self.db.close
|
||||
self.get = self.db.get
|
||||
@@ -99,12 +101,13 @@ class RocksDB(Storage):
|
||||
|
||||
def open(self, name, create):
|
||||
mof = 512 if self.for_sync else 128
|
||||
path = os.path.join(self.db_dir, name)
|
||||
# Use snappy compression (the default)
|
||||
options = self.module.Options(create_if_missing=create,
|
||||
use_fsync=True,
|
||||
target_file_size_base=33554432,
|
||||
max_open_files=mof)
|
||||
self.db = self.module.DB(name, options)
|
||||
self.db = self.module.DB(path, options)
|
||||
self.get = self.db.get
|
||||
self.put = self.db.put
|
||||
|
||||
|
||||
@@ -145,8 +145,8 @@ class Stream:
|
||||
def first(self):
|
||||
future = asyncio.get_event_loop().create_future()
|
||||
subscription = self.listen(
|
||||
lambda value: self._cancel_and_callback(subscription, future, value),
|
||||
lambda exception: self._cancel_and_error(subscription, future, exception)
|
||||
lambda value: not future.done() and self._cancel_and_callback(subscription, future, value),
|
||||
lambda exception: not future.done() and self._cancel_and_error(subscription, future, exception)
|
||||
)
|
||||
return future
|
||||
|
||||
|
||||
Reference in new issue
Block a user