Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3a0affe8ba |
No files matched your search
@@ -2,6 +2,6 @@
|
||||
.tox
|
||||
__pycache__
|
||||
dist
|
||||
lbry.egg-info
|
||||
lbrynet.egg-info
|
||||
docs
|
||||
tests
|
||||
@@ -0,0 +1,74 @@
|
||||
<!--
|
||||
Thanks for reporting an issue to LBRY and helping us improve!
|
||||
|
||||
To make it possible for us to help you, please fill out below information carefully.
|
||||
|
||||
Before reporting any issues, please make sure that you're using the latest version.
|
||||
- App: https://github.com/lbryio/lbry-desktop/releases
|
||||
- Daemon: https://github.com/lbryio/lbry/releases
|
||||
|
||||
We are also available on Discord at https://chat.lbry.com
|
||||
-->
|
||||
|
||||
|
||||
## The Issue
|
||||
|
||||
In order to <achieve some value>,
|
||||
as a <type of user>,
|
||||
I want <some functionality>.
|
||||
|
||||
|
||||
### Steps to reproduce
|
||||
1.
|
||||
2.
|
||||
3.
|
||||
|
||||
### Expected behaviour
|
||||
Tell us what should happen
|
||||
|
||||
### Actual behaviour
|
||||
Tell us what happens instead
|
||||
|
||||
|
||||
## System Configuration
|
||||
|
||||
<!-- For the app, this info is in the About section at the bottom of the Help page.
|
||||
You can include a screenshot instead of typing it out -->
|
||||
|
||||
<!-- For the daemon, run:
|
||||
curl 'http://localhost:5279' --data '{"method":"version"}'
|
||||
and include the full output -->
|
||||
|
||||
- LBRY Daemon version:
|
||||
- LBRY App version:
|
||||
- LBRY Installation ID:
|
||||
- Operating system:
|
||||
|
||||
|
||||
## Anything Else
|
||||
<!-- Include anything else that does not fit into the above sections -->
|
||||
|
||||
|
||||
## Screenshots
|
||||
<!-- If a screenshot would help explain the bug, please include one or two here -->
|
||||
|
||||
|
||||
|
||||
## Internal Use
|
||||
|
||||
### Acceptance Criteria
|
||||
1.
|
||||
2.
|
||||
3.
|
||||
|
||||
### Definition of Done
|
||||
- [ ] Tested against acceptance criteria
|
||||
- [ ] Tested against the assumptions of user story
|
||||
- [ ] The project builds without errors
|
||||
- [ ] Unit tests are written and passing
|
||||
- [ ] Tests on devices/browsers listed in the issue have passed
|
||||
- [ ] QA performed & issues resolved
|
||||
- [ ] Refactoring completed
|
||||
- [ ] Any configuration or build changes documented
|
||||
- [ ] Documentation updated
|
||||
- [ ] Peer Code Review performed
|
||||
@@ -0,0 +1,38 @@
|
||||
## PR Checklist
|
||||
Please check all that apply to this PR using "x":
|
||||
|
||||
- [ ] I have checked that this PR is not a duplicate of an existing PR (open, closed or merged)
|
||||
- [ ] I have checked that this PR does not introduce a breaking change
|
||||
- [ ] This PR introduces breaking changes and I have provided a detailed explanation below
|
||||
|
||||
|
||||
## PR Type
|
||||
What kind of change does this PR introduce?
|
||||
|
||||
Why is this change necessary?
|
||||
|
||||
<!-- Please check all that apply to this PR using "x". -->
|
||||
|
||||
- [ ] Bugfix
|
||||
- [ ] Feature
|
||||
- [ ] Breaking changes (bugfix or feature that introduces breaking changes)
|
||||
- [ ] Code style update (formatting)
|
||||
- [ ] Refactoring (no functional changes)
|
||||
- [ ] Documentation changes
|
||||
- [ ] Other - Please describe:
|
||||
|
||||
## Fixes
|
||||
|
||||
Issue Number: N/A
|
||||
|
||||
|
||||
## What is the current behavior?
|
||||
|
||||
|
||||
## What is the new behavior?
|
||||
|
||||
|
||||
## Other information
|
||||
|
||||
|
||||
<!-- If this PR contains a breaking change, please describe the impact and solution strategy for existing applications below. -->
|
||||
@@ -1,2 +1,13 @@
|
||||
.DS_Store
|
||||
/build
|
||||
/dist
|
||||
/.tox
|
||||
/.idea
|
||||
/.DS_Store
|
||||
/.coverage
|
||||
/lbry-venv
|
||||
|
||||
lbrynet.egg-info
|
||||
__pycache__
|
||||
_trial_temp/
|
||||
|
||||
/tests/integration/files
|
||||
@@ -24,7 +24,7 @@ persistent=yes
|
||||
load-plugins=
|
||||
|
||||
# Use multiple processes to speed up Pylint.
|
||||
jobs=4
|
||||
jobs=1
|
||||
|
||||
# Allow loading of arbitrary C extensions. Extensions are imported into the
|
||||
# active Python interpreter and may run arbitrary code.
|
||||
@@ -77,6 +77,8 @@ disable=
|
||||
dangerous-default-value,
|
||||
duplicate-code,
|
||||
fixme,
|
||||
global-statement,
|
||||
inherit-non-class,
|
||||
invalid-name,
|
||||
len-as-condition,
|
||||
locally-disabled,
|
||||
@@ -109,11 +111,13 @@ disable=
|
||||
unnecessary-lambda,
|
||||
unused-argument,
|
||||
unused-variable,
|
||||
wildcard-import,
|
||||
wrong-import-order,
|
||||
wrong-import-position,
|
||||
deprecated-lambda,
|
||||
simplifiable-if-statement,
|
||||
unidiomatic-typecheck,
|
||||
global-at-module-level,
|
||||
inconsistent-return-statements,
|
||||
keyword-arg-before-vararg,
|
||||
assignment-from-no-return,
|
||||
@@ -3,143 +3,143 @@ dist: xenial
|
||||
language: python
|
||||
python: "3.7"
|
||||
|
||||
env:
|
||||
global:
|
||||
# must also be updated in wine_build.sh
|
||||
- TORBA=master
|
||||
|
||||
jobs:
|
||||
include:
|
||||
|
||||
- stage: code quality
|
||||
name: "pylint & mypy"
|
||||
name: "pylint lbrynet"
|
||||
install:
|
||||
- make install
|
||||
script: make lint
|
||||
- pip install astroid pylint
|
||||
- pip install git+https://github.com/lbryio/torba.git@${TORBA}#egg=torba
|
||||
- pip install -e .
|
||||
script: pylint lbrynet
|
||||
|
||||
- stage: test
|
||||
name: "LBRY Unit Tests"
|
||||
name: "Unit Tests"
|
||||
install:
|
||||
- make install
|
||||
- pip install coverage
|
||||
- pip install git+https://github.com/lbryio/torba.git@${TORBA}#egg=torba
|
||||
- pip install -e .
|
||||
script:
|
||||
- cd lbry && HOME=/tmp coverage run -p --source=lbry -m unittest discover -vv tests.unit
|
||||
- HOME=/tmp coverage run -p --source=lbrynet -m unittest discover -vv tests.unit
|
||||
after_success:
|
||||
- coverage combine lbry/
|
||||
- coverage combine
|
||||
- bash <(curl -s https://codecov.io/bash)
|
||||
|
||||
- name: "LBRY Integration Tests"
|
||||
- name: "Integration Tests"
|
||||
install:
|
||||
- pip install coverage tox-travis
|
||||
script: cd lbry && tox
|
||||
after_success:
|
||||
- coverage combine lbry
|
||||
- bash <(curl -s https://codecov.io/bash)
|
||||
- pip install tox-travis coverage
|
||||
- pushd .. && git clone --single-branch --branch ${TORBA} https://github.com/lbryio/torba.git && popd
|
||||
|
||||
- &torba-tests
|
||||
name: "Torba Unit Tests"
|
||||
env: TESTTYPE=unit
|
||||
install:
|
||||
- pip install coverage tox-travis
|
||||
script: cd torba && tox
|
||||
script: tox
|
||||
after_success:
|
||||
- coverage combine torba/tests
|
||||
- coverage combine tests/
|
||||
- bash <(curl -s https://codecov.io/bash)
|
||||
|
||||
- <<: *torba-tests
|
||||
name: "Torba Integration Tests"
|
||||
env: TESTTYPE=integration
|
||||
|
||||
- name: "Run Examples"
|
||||
install:
|
||||
- make install
|
||||
script:
|
||||
- cd lbry && HOME=/tmp coverage run -p --source=lbry scripts/generate_json_api.py
|
||||
after_success:
|
||||
- coverage combine lbry
|
||||
- bash <(curl -s https://codecov.io/bash)
|
||||
|
||||
- &build
|
||||
stage: build
|
||||
name: "Linux"
|
||||
env: OS=linux
|
||||
install:
|
||||
- pip install pyinstaller awscli
|
||||
- cd torba && pip install -e . && cd ..
|
||||
- cd lbry
|
||||
- python scripts/set_build.py
|
||||
- pip install coverage
|
||||
- pip install git+https://github.com/lbryio/torba.git@${TORBA}#egg=torba
|
||||
- pip install -e .
|
||||
script:
|
||||
- pyinstaller -F -n lbrynet lbry/extras/cli.py
|
||||
- cd dist
|
||||
- chmod +x lbrynet
|
||||
- zip -j lbrynet-${OS}.zip lbrynet
|
||||
- shasum -a 256 -b lbrynet-${OS}.zip
|
||||
- ./lbrynet --version
|
||||
- HOME=/tmp coverage run -p --source=lbrynet scripts/generate_json_api.py
|
||||
after_success:
|
||||
- aws configure set aws_access_key_id $ARTIFACTS_KEY
|
||||
- aws configure set aws_secret_access_key $ARTIFACTS_SECRET
|
||||
- aws configure set region us-east-1
|
||||
- export S3_PATH="daemon/build-${TRAVIS_BUILD_NUMBER}_commit-${TRAVIS_COMMIT:0:7}_branch-${TRAVIS_BRANCH}$([ ! -z ${TRAVIS_TAG} ] && echo _tag-${TRAVIS_TAG})"
|
||||
- aws s3 cp lbrynet-${OS}.zip s3://build.lbry.io/${S3_PATH}/lbrynet-${OS}.zip
|
||||
- coverage combine
|
||||
- bash <(curl -s https://codecov.io/bash)
|
||||
|
||||
- stage: build
|
||||
name: "Windows"
|
||||
language: generic
|
||||
services:
|
||||
- docker
|
||||
install:
|
||||
- docker pull lbry/pyinstaller34_32bits:py371
|
||||
script:
|
||||
- python scripts/set_build.py
|
||||
- docker run -v "$(pwd):/src/lbry" lbry/pyinstaller34_32bits:py371 lbry/scripts/wine_build.sh
|
||||
- sudo zip -j dist/lbrynet-windows.zip dist/lbrynet.exe
|
||||
deploy:
|
||||
provider: releases
|
||||
api_key:
|
||||
secure: "unnR+aSJ1937Cl1PyBBZzGuZvV5W5TGcXELhXTgyOeeI6FgO/j80qmbNxJDA7qdFH/hvVicQFWoflhZu2dxN5rYP5BQJW3q3XoOLY3XAc1s1vicFkwqn3TIfdFiJTz+/D9eBUBBhHKeYFxm3M+thvklTLgjKl6fflh14NfGuNTevK9yQke8wewW3f9UmFTo1qNOPF1OsTZRbwua6oQYa59P+KukoPt4Dsu1VtILtTkj7hfEsUL79cjotwO3gkhYftxbl/xeDSZWOt+9Nhb8ZKmQG/uDx4JiTMm5lWRk4QB7pUujZ1CftxCYWz/lJx9nuJpdCOgP624tcHymErNlD+vGLwMTNslcXGYkAJH6xvGyxBJ+Obc8vRVnZbRM26BfH34TcPK1ueRxHSrDUbzMIIUsgcoZAxBuim8uDPp+K7bGqiygzSs2vQfr9U5Jhe9/F8sPdtNctfJZEfgmthNTeVFjyNsGIfIt754uGSfACqM7wDLh6fbKx7M+FHlNyOdvYCrbKUOAYXmTikYIpVDvlaaeMO+N+uW8Rhvm1j+JU7CVwhMavLySaPVc6Dt5OxiMMmxw9mVrjW9bBPjS5AkrS5MOA13T5wapoLzH6+gE92U4HzA6ilMcwRaQPSFnK2JU7tzyt2Wy1PH4MjHowXI2WyICG1x510dD3tX1P/1px8ro="
|
||||
file: lbrynet-${OS}.zip
|
||||
api_key: $GITHUB_OAUTH_TOKEN
|
||||
file: dist/lbrynet-windows.zip
|
||||
skip_cleanup: true
|
||||
overwrite: true
|
||||
draft: true
|
||||
on:
|
||||
tags: true
|
||||
addons:
|
||||
artifacts:
|
||||
working_dir: dist
|
||||
paths:
|
||||
- lbrynet-windows.zip
|
||||
target_paths:
|
||||
- /daemon/build-${TRAVIS_BUILD_NUMBER}_commit-${TRAVIS_COMMIT:0:7}_branch-${TRAVIS_BRANCH}$([ ! -z ${TRAVIS_TAG} ] && echo _tag-${TRAVIS_TAG})
|
||||
|
||||
- &build
|
||||
name: "Linux"
|
||||
env: OS=linux
|
||||
install:
|
||||
- pip3 install pyinstaller
|
||||
- pip3 install git+https://github.com/lbryio/torba.git@${TORBA}#egg=torba
|
||||
- python3 scripts/set_build.py
|
||||
- pip3 install -e .
|
||||
script:
|
||||
- pyinstaller -F -n lbrynet lbrynet/extras/cli.py
|
||||
- chmod +x dist/lbrynet
|
||||
- zip -j dist/lbrynet-${OS}.zip dist/lbrynet
|
||||
- ./dist/lbrynet --version
|
||||
deploy:
|
||||
provider: releases
|
||||
api_key: $GITHUB_OAUTH_TOKEN
|
||||
file: dist/lbrynet-${OS}.zip
|
||||
skip_cleanup: true
|
||||
overwrite: true
|
||||
draft: true
|
||||
on:
|
||||
tags: true
|
||||
addons:
|
||||
artifacts:
|
||||
working_dir: dist
|
||||
paths:
|
||||
- lbrynet-${OS}.zip
|
||||
# artifact uploader thinks lbrynet is a directory, https://github.com/travis-ci/artifacts/issues/78
|
||||
target_paths:
|
||||
- /daemon/build-${TRAVIS_BUILD_NUMBER}_commit-${TRAVIS_COMMIT:0:7}_branch-${TRAVIS_BRANCH}$([ ! -z ${TRAVIS_TAG} ] && echo _tag-${TRAVIS_TAG})
|
||||
|
||||
- <<: *build
|
||||
name: "Mac"
|
||||
os: osx
|
||||
osx_image: xcode8.3
|
||||
language: shell
|
||||
language: generic
|
||||
env: OS=mac
|
||||
cache: false
|
||||
before_install:
|
||||
- brew upgrade python || true
|
||||
- pip3 install --user --upgrade pip virtualenv
|
||||
- /Users/travis/Library/Python/3.7/bin/virtualenv $HOME/venv
|
||||
- source $HOME/venv/bin/activate
|
||||
before_cache:
|
||||
- brew cleanup
|
||||
|
||||
- <<: *build
|
||||
name: "Windows"
|
||||
os: windows
|
||||
language: shell
|
||||
env:
|
||||
- OS=windows
|
||||
- PATH=/c/Python37:/c/Python37/Scripts:/C/Windows/System32/downlevel:$PATH
|
||||
before_install:
|
||||
- choco install python --x86
|
||||
- python -m pip install --upgrade pip
|
||||
- pip install pywin32
|
||||
script:
|
||||
- pyinstaller --additional-hooks-dir=scripts/. --icon=icons/lbry256.ico -F -n lbrynet lbry/extras/cli.py
|
||||
- cd dist
|
||||
- 7z a -tzip lbrynet-windows.zip lbrynet.exe
|
||||
- sha256sum -b lbrynet-windows.zip
|
||||
- ./lbrynet.exe --version
|
||||
- brew upgrade python || true
|
||||
- if: tag IS present
|
||||
stage: build
|
||||
name: "Wallet Server Docker Image - Tagged Release"
|
||||
script:
|
||||
- set -e
|
||||
- echo "$DOCKER_PASSWORD" | docker login --username "$DOCKER_USERNAME" --password-stdin
|
||||
- travis_retry docker build -t lbry/wallet-server:$TRAVIS_TAG -f lbry/scripts/Dockerfile.wallet_server .
|
||||
- travis_retry docker build -t lbry/wallet-server:$TRAVIS_TAG -f scripts/Dockerfile.wallet_server --build-arg TORBA_VERSION=${TORBA} .
|
||||
- docker push lbry/wallet-server:$TRAVIS_TAG
|
||||
|
||||
- if: tag IS blank AND branch = master AND NOT type IN (pull_request)
|
||||
stage: build
|
||||
name: "Wallet Server Docker Image - Master"
|
||||
script:
|
||||
- set -e
|
||||
- echo "$DOCKER_PASSWORD" | docker login --username "$DOCKER_USERNAME" --password-stdin
|
||||
- travis_retry docker build -t lbry/wallet-server:master -f lbry/scripts/Dockerfile.wallet_server .
|
||||
- travis_retry docker build -t lbry/wallet-server:master -f scripts/Dockerfile.wallet_server --build-arg TORBA_VERSION=${TORBA} .
|
||||
- docker push lbry/wallet-server:master
|
||||
|
||||
cache:
|
||||
directories:
|
||||
- $HOME/venv
|
||||
- $HOME/.cache/pip
|
||||
- $HOME/Library/Caches/pip
|
||||
- $HOME/Library/Caches/Homebrew
|
||||
- $TRAVIS_BUILD_DIR/.tox
|
||||
@@ -0,0 +1,6 @@
|
||||
# Add a CHANGELOG entry for app changes
|
||||
has_app_changes = !git.modified_files.grep(/lbrynet/).empty?
|
||||
if !git.modified_files.include?("CHANGELOG.md") && has_app_changes
|
||||
fail("Please include a CHANGELOG entry.")
|
||||
message "See http://keepachangelog.com/en/0.3.0/ for details on good changelog guidelines"
|
||||
end
|
||||
@@ -31,12 +31,10 @@ Assistance installing Python3: https://docs.python-guide.org/starting/install3/o
|
||||
|
||||
### Linux
|
||||
|
||||
On Ubuntu (16.04 minimum, we recommend 18.04), install the following:
|
||||
On Ubuntu (we recommend 18.04), install the following:
|
||||
|
||||
```
|
||||
sudo add-apt-repository ppa:deadsnakes/ppa
|
||||
sudo apt-get update
|
||||
sudo apt-get install build-essential python3.7 python3.7-dev git python3.7-venv libssl-dev python-protobuf
|
||||
sudo apt-get install build-essential python3.7 python3.7-dev git python3-venv libssl-dev python-protobuf
|
||||
```
|
||||
|
||||
On Raspbian, you will also need to install `python-pyparsing`.
|
||||
@@ -45,61 +43,32 @@ If you're running another Linux distro, install the equivalent of the above pack
|
||||
|
||||
## Installation
|
||||
|
||||
### Linux/Mac
|
||||
|
||||
To install on Linux/Mac:
|
||||
To install:
|
||||
|
||||
```
|
||||
Clone the repository:
|
||||
$ git clone https://github.com/lbryio/lbry-sdk.git
|
||||
$ cd lbry-sdk
|
||||
git clone https://github.com/lbryio/lbry.git
|
||||
cd lbry
|
||||
|
||||
Create a Python virtual environment for lbry-sdk:
|
||||
$ python3.7 -m venv lbry-venv
|
||||
Creating venv:
|
||||
python -m venv lbry-venv
|
||||
|
||||
Activating lbry-sdk virtual environment:
|
||||
$ source lbry-venv/bin/activate
|
||||
Activating lbry-venv on Linux/Mac:
|
||||
source lbry-venv/bin/activate
|
||||
|
||||
Make sure you're on Python 3.7+ (as the default Python in virtual environment):
|
||||
$ python --version
|
||||
Activating lbry-venv on Windows:
|
||||
lbry-venv\Scripts\activate
|
||||
|
||||
Install packages:
|
||||
$ make install
|
||||
python --version # Python 2 is not supported. Make sure you're on Python 3.7
|
||||
|
||||
If you are on Linux and using PyCharm, generates initial configs:
|
||||
$ make idea
|
||||
pip install -e .
|
||||
```
|
||||
|
||||
To verify your installation, `which lbrynet` should return a path inside of the `lbry-venv` folder created by the `python3.7 -m venv lbry-venv` command.
|
||||
|
||||
### Windows
|
||||
|
||||
To install on Windows:
|
||||
|
||||
```
|
||||
Clone the repository:
|
||||
> git clone https://github.com/lbryio/lbry-sdk.git
|
||||
> cd lbry-sdk
|
||||
|
||||
Create a Python virtual environment for lbry-sdk:
|
||||
> python -m venv lbry-venv
|
||||
|
||||
Activating lbry-sdk virtual environment:
|
||||
> lbry-venv\Scripts\activate
|
||||
|
||||
Install packages:
|
||||
> cd torba
|
||||
> pip install -e .
|
||||
> cd ../lbry
|
||||
> pip install -e .
|
||||
```
|
||||
To verify your installation, `which lbrynet` should return a path inside of the `lbry-venv` folder created by the `virtualenv` command.
|
||||
|
||||
## Run the tests
|
||||
|
||||
To run the unit tests from the repo directory:
|
||||
|
||||
```
|
||||
python -m unittest discover -s lbry tests.unit
|
||||
trial --reactor=asyncio tests.unit
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
install:
|
||||
cd torba && pip install -e .
|
||||
cd lbry && pip install -e .
|
||||
pip install mypy==0.701
|
||||
pip install coverage astroid pylint
|
||||
|
||||
lint:
|
||||
cd lbry && pylint lbry
|
||||
cd torba && pylint --rcfile=setup.cfg torba
|
||||
cd torba && mypy --ignore-missing-imports torba
|
||||
|
||||
test:
|
||||
cd lbry && tox
|
||||
cd torba && tox
|
||||
|
||||
idea:
|
||||
mkdir -p .idea
|
||||
cp -r lbry/scripts/idea/* .idea
|
||||
@@ -1,19 +1,19 @@
|
||||
# <img src="https://raw.githubusercontent.com/lbryio/lbry-sdk/master/lbry/lbry.png" alt="LBRY" width="48" height="36" /> LBRY SDK [](https://travis-ci.org/lbryio/lbry-sdk) [](https://codecov.io/gh/lbryio/lbry-sdk)
|
||||
# <img src="https://raw.githubusercontent.com/lbryio/lbry/master/lbry.png" alt="LBRY" width="48" height="36" /> LBRY SDK [](https://travis-ci.org/lbryio/lbry) [](https://codecov.io/gh/lbryio/lbry)
|
||||
|
||||
LBRY is a decentralized peer-to-peer protocol for publishing and accessing digital content. It utilizes the [LBRY blockchain](https://github.com/lbryio/lbrycrd) as a global namespace and database of digital content. Blockchain entries contain searchable content metadata, identities, rights and access rules. LBRY also provides a data network that consists of peers (seeders) uploading and downloading data from other peers, possibly in exchange for payments, as well as a distributed hash table used by peers to discover other peers.
|
||||
|
||||
LBRY SDK for Python is currently the most full featured implementation of the LBRY Network protocols and includes many useful components and tools for building decentralized applications. Primary features and components:
|
||||
|
||||
* Built on Python 3.7+ and `asyncio`.
|
||||
* Kademlia DHT (Distributed Hash Table) implementation for finding peers to download from and announcing to peers what we have to host ([lbry.dht](https://github.com/lbryio/lbry-sdk/tree/master/lbry/lbry/dht)).
|
||||
* Blob exchange protocol for transferring encrypted blobs of content and negotiating payments ([lbry.blob_exchange](https://github.com/lbryio/lbry-sdk/tree/master/lbry/lbry/blob_exchange)).
|
||||
* Protobuf schema for encoding and decoding metadata stored on the blockchain ([lbry.schema](https://github.com/lbryio/lbry-sdk/tree/master/lbry/lbry/schema)).
|
||||
* Wallet implementation for the LBRY blockchain ([lbry.wallet](https://github.com/lbryio/lbry-sdk/tree/master/lbry/lbry/wallet)).
|
||||
* Daemon with a JSON-RPC API to ease building end user applications in any language and for automating various tasks ([lbry.extras.daemon](https://github.com/lbryio/lbry-sdk/tree/master/lbry/lbry/extras/daemon)).
|
||||
* Kademlia DHT (Distributed Hash Table) implementation for finding peers to download from and announcing to peers what we have to host ([lbrynet.dht](https://github.com/lbryio/lbry/tree/master/lbrynet/dht)).
|
||||
* Blob exchange protocol for transferring encrypted blobs of content and negotiating payments ([lbrynet.blob_exchange](https://github.com/lbryio/lbry/tree/master/lbrynet/blob_exchange)).
|
||||
* Protobuf schema for encoding and decoding metadata stored on the blockchain ([lbrynet.schema](https://github.com/lbryio/lbry/tree/master/lbrynet/schema)).
|
||||
* Wallet implementation for the LBRY blockchain ([lbrynet.wallet](https://github.com/lbryio/lbry/tree/master/lbrynet/wallet)).
|
||||
* Daemon with a JSON-RPC API to ease building end user applications in any language and for automating various tasks ([lbrynet.extras.daemon](https://github.com/lbryio/lbry/tree/master/lbrynet/extras/daemon)).
|
||||
|
||||
## Installation
|
||||
|
||||
Our [releases page](https://github.com/lbryio/lbry-sdk/releases) contains pre-built binaries of the latest release, pre-releases, and past releases for macOS, Debian-based Linux, and Windows. [Automated travis builds](http://build.lbry.io/daemon/) are also available for testing.
|
||||
Our [releases page](https://github.com/lbryio/lbry/releases) contains pre-built binaries of the latest release, pre-releases, and past releases for macOS, Debian-based Linux, and Windows. [Automated travis builds](http://build.lbry.io/daemon/) are also available for testing.
|
||||
|
||||
## Usage
|
||||
|
||||
@@ -53,4 +53,4 @@ The documentation for the API can be found [here](https://lbry.tech/api/sdk).
|
||||
|
||||
Daemon defaults, ports, and other settings are documented [here](https://lbry.tech/resources/daemon-settings).
|
||||
|
||||
Settings can be configured using a daemon-settings.yml file. An example can be found [here](https://github.com/lbryio/lbry-sdk/blob/master/lbry/example_daemon_settings.yml).
|
||||
Settings can be configured using a daemon-settings.yml file. An example can be found [here](https://github.com/lbryio/lbry/blob/master/example_daemon_settings.yml).
|
||||
@@ -41,10 +41,10 @@
|
||||
"examples": [
|
||||
{
|
||||
"title": "Get a file",
|
||||
"curl": "curl -d'{\"method\": \"get\", \"params\": {\"uri\": \"astream#5d64500fb723eded83a41b0d5055f1783f019191\"}}' http://localhost:5279/",
|
||||
"lbrynet": "lbrynet get astream#5d64500fb723eded83a41b0d5055f1783f019191",
|
||||
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"get\", \"params\": {\"uri\": \"astream#5d64500fb723eded83a41b0d5055f1783f019191\"}}).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\": \"7ed794458d57978c49572424e1d32c7fa4d5325e\",\n \"channel_name\": \"@channel\",\n \"claim_id\": \"5d64500fb723eded83a41b0d5055f1783f019191\",\n \"claim_name\": \"astream\",\n \"completed\": true,\n \"confirmations\": 3,\n \"content_fee\": null,\n \"download_directory\": \"/tmp/tmpfjnst0c0\",\n \"download_path\": \"/tmp/tmpfjnst0c0/tmpzj1qbxfj\",\n \"file_name\": \"tmpzj1qbxfj\",\n \"height\": 214,\n \"key\": \"e8b365259d5b8644a6a1eb5d2f77459f\",\n \"metadata\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpzj1qbxfj\",\n \"sd_hash\": \"d85e47456630442a413f6cbedbdc4b0a5177770155d8a4523bbf2f301ebae95e0785cb475ca8d1a9d3cab54a05de64d3\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"mime_type\": \"application/octet-stream\",\n \"nout\": 0,\n \"outpoint\": \"dac2f1adaf5debd8cb377673b35ee4e6eb62ba7747b4440ffdb44d6875c2197e:0\",\n \"points_paid\": 0.0,\n \"protobuf\": \"015e32d5a47f2cd3e1242457498c97578d4594d77ee519fc56b21384e97c75d5c1b6450f2138e209f7bbd2adb588609ba36d1982a2187070c391a89793a0b569f09fef656fe041eab1809e3964f6346ae0fb3d20f30a90010a8d010a30fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd120b746d707a6a31716278666a180b22186170706c69636174696f6e2f6f637465742d73747265616d3230d85e47456630442a413f6cbedbdc4b0a5177770155d8a4523bbf2f301ebae95e0785cb475ca8d1a9d3cab54a05de64d3\",\n \"sd_hash\": \"d85e47456630442a413f6cbedbdc4b0a5177770155d8a4523bbf2f301ebae95e0785cb475ca8d1a9d3cab54a05de64d3\",\n \"status\": \"finished\",\n \"stopped\": true,\n \"stream_hash\": \"8b7dee36b0985027ad1476590ee5759359b57e4cb6507d5288ffe1508c32177f5a39ef20772cf90da72987f6f55ce1ba\",\n \"stream_name\": \"tmpzj1qbxfj\",\n \"streaming_url\": \"http://localhost:5280/stream/d85e47456630442a413f6cbedbdc4b0a5177770155d8a4523bbf2f301ebae95e0785cb475ca8d1a9d3cab54a05de64d3\",\n \"suggested_file_name\": \"tmpzj1qbxfj\",\n \"timestamp\": 1561485090,\n \"total_bytes\": 16,\n \"total_bytes_lower_bound\": 0,\n \"txid\": \"dac2f1adaf5debd8cb377673b35ee4e6eb62ba7747b4440ffdb44d6875c2197e\",\n \"written_bytes\": 11\n }\n}"
|
||||
"curl": "curl -d'{\"method\": \"get\", \"params\": {\"uri\": \"astream#ffdbe8f44f285fbc4a352763727abd86d17399c1\"}}' http://localhost:5279/",
|
||||
"lbrynet": "lbrynet get astream#ffdbe8f44f285fbc4a352763727abd86d17399c1",
|
||||
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"get\", \"params\": {\"uri\": \"astream#ffdbe8f44f285fbc4a352763727abd86d17399c1\"}}).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\": \"682bdf7e3ea6564bcf8aebe3cf227544189d1a6d\",\n \"channel_name\": \"@channel\",\n \"claim_id\": \"ffdbe8f44f285fbc4a352763727abd86d17399c1\",\n \"claim_name\": \"astream\",\n \"completed\": true,\n \"confirmations\": 3,\n \"content_fee\": null,\n \"download_directory\": \"/tmp/tmpf06o5qj4\",\n \"download_path\": \"/tmp/tmpf06o5qj4/tmp6h32p99s\",\n \"file_name\": \"tmp6h32p99s\",\n \"height\": 214,\n \"key\": \"1441a34034b2dbc19094f1c7b164680c\",\n \"metadata\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmp6h32p99s\",\n \"sd_hash\": \"e38f25767c7619948832380b12def270aa244ee0b712020551198b2c587babb08583b7ad928ea08f71e1a6ced74836e0\",\n \"size\": \"11\"\n }\n },\n \"mime_type\": \"application/octet-stream\",\n \"nout\": 0,\n \"outpoint\": \"fa78db71b5e4205ec33a69106f9c9528ed9289fa3f8efc51baebe6e514247287:0\",\n \"points_paid\": 0.0,\n \"protobuf\": \"016d1a9d18447522cfe3eb8acf4b56a63e7edf2b68fdfdb7869eb7447ab2e61a2d5cdf8199867bda63dd1edc699b7dee31d618198502a11309baff2f6d52104f494ca48ff9e5961c5a00badba23fcfeb010f595fc10a90010a8d010a30fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd120b746d703668333270393973180b22186170706c69636174696f6e2f6f637465742d73747265616d3230e38f25767c7619948832380b12def270aa244ee0b712020551198b2c587babb08583b7ad928ea08f71e1a6ced74836e0\",\n \"sd_hash\": \"e38f25767c7619948832380b12def270aa244ee0b712020551198b2c587babb08583b7ad928ea08f71e1a6ced74836e0\",\n \"status\": \"finished\",\n \"stopped\": true,\n \"stream_hash\": \"e5189cf47e5bdecdef6ec77874410bf7d57ac71ccfb4e6588311a7375c890e513be365538d51068fe97a0c21a8e389e0\",\n \"stream_name\": \"tmp6h32p99s\",\n \"streaming_url\": \"http://localhost:5280/stream/e38f25767c7619948832380b12def270aa244ee0b712020551198b2c587babb08583b7ad928ea08f71e1a6ced74836e0\",\n \"suggested_file_name\": \"tmp6h32p99s\",\n \"timestamp\": 1559011814,\n \"total_bytes\": 16,\n \"total_bytes_lower_bound\": 0,\n \"txid\": \"fa78db71b5e4205ec33a69106f9c9528ed9289fa3f8efc51baebe6e514247287\",\n \"written_bytes\": 11\n }\n}"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -201,22 +201,16 @@
|
||||
"type": "bool",
|
||||
"description": "do not broadcast the transaction",
|
||||
"is_required": false
|
||||
},
|
||||
{
|
||||
"name": "blocking",
|
||||
"type": "bool",
|
||||
"description": "wait until transaction is in mempool",
|
||||
"is_required": false
|
||||
}
|
||||
],
|
||||
"returns": " {\n \"txid\": \"hash of transaction in hex\",\n \"height\": \"block where transaction was recorded\",\n \"inputs\": [\n {\n \"txid\": \"hash of transaction in hex\",\n \"nout\": \"position in the transaction\",\n \"height\": \"block where transaction was recorded\",\n \"amount\": \"value of the txo as a decimal\",\n \"address\": \"address of who can spend the txo\",\n \"confirmations\": \"number of confirmed blocks\",\n \"is_change\": \"payment to change address, only available when it can be determined\",\n \"is_mine\": \"payment to one of your accounts, only available when it can be determined\",\n \"type\": \"one of 'claim', 'support' or 'payment'\",\n \"name\": \"when type is 'claim' or 'support', this is the claim name\",\n \"claim_id\": \"when type is 'claim' or 'support', this is the claim id\",\n \"claim_op\": \"when type is 'claim', this determines if it is 'create' or 'update'\",\n \"value\": \"when type is 'claim' or 'support' with payload, this is the decoded protobuf payload\",\n \"value_type\": \"determines the type of the 'value' field: 'channel', 'stream', etc\",\n \"protobuf\": \"hex encoded raw protobuf version of 'value' field\",\n \"permanent_url\": \"when type is 'claim' or 'support', this is the long permanent claim URL\",\n \"signing_channel\": \"for signed claims only, metadata of signing channel\",\n \"is_channel_signature_valid\": \"for signed claims only, whether signature is valid\"\n }\n ],\n \"outputs\": [\n {\n \"txid\": \"hash of transaction in hex\",\n \"nout\": \"position in the transaction\",\n \"height\": \"block where transaction was recorded\",\n \"amount\": \"value of the txo as a decimal\",\n \"address\": \"address of who can spend the txo\",\n \"confirmations\": \"number of confirmed blocks\",\n \"is_change\": \"payment to change address, only available when it can be determined\",\n \"is_mine\": \"payment to one of your accounts, only available when it can be determined\",\n \"type\": \"one of 'claim', 'support' or 'payment'\",\n \"name\": \"when type is 'claim' or 'support', this is the claim name\",\n \"claim_id\": \"when type is 'claim' or 'support', this is the claim id\",\n \"claim_op\": \"when type is 'claim', this determines if it is 'create' or 'update'\",\n \"value\": \"when type is 'claim' or 'support' with payload, this is the decoded protobuf payload\",\n \"value_type\": \"determines the type of the 'value' field: 'channel', 'stream', etc\",\n \"protobuf\": \"hex encoded raw protobuf version of 'value' field\",\n \"permanent_url\": \"when type is 'claim' or 'support', this is the long permanent claim URL\",\n \"signing_channel\": \"for signed claims only, metadata of signing channel\",\n \"is_channel_signature_valid\": \"for signed claims only, whether signature is valid\"\n }\n ],\n \"total_input\": \"sum of inputs as a decimal\",\n \"total_output\": \"sum of outputs, sans fee, as a decimal\",\n \"total_fee\": \"fee amount\",\n \"hex\": \"entire transaction encoded in hex\"\n }",
|
||||
"examples": [
|
||||
{
|
||||
"title": "Publish a file",
|
||||
"curl": "curl -d'{\"method\": \"publish\", \"params\": {\"name\": \"a-new-stream\", \"bid\": \"1.0\", \"file_path\": \"/tmp/tmpj0rdjqc7\", \"tags\": [], \"languages\": [], \"locations\": [], \"channel_account_id\": [], \"preview\": false, \"blocking\": false}}' http://localhost:5279/",
|
||||
"lbrynet": "lbrynet publish a-new-stream --bid=1.0 --file_path=/tmp/tmpj0rdjqc7",
|
||||
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"publish\", \"params\": {\"name\": \"a-new-stream\", \"bid\": \"1.0\", \"file_path\": \"/tmp/tmpj0rdjqc7\", \"tags\": [], \"languages\": [], \"locations\": [], \"channel_account_id\": [], \"preview\": false, \"blocking\": false}}).json()",
|
||||
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"01000000010f6edeb77e3d75b4cdfd5704e4d14ff2fa21948a5b26335aa3e69c8749d6a662010000006b483045022100d85e9ac9781bbaab17e5001055399ecd14b2a31077475734b6a6ccc7e668250e02200d6649e3deea9ca557aa897a32312aed841c56d94d095062c390b718f83e4ea0012102eea5cb67d3c756c1de57f503d4899d9560f1c689c38dfa9339d8020c04cf60e6ffffffff0200e1f50500000000bfb50c612d6e65772d73747265616d4c94000a90010a8d010a30fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd120b746d706a3072646a716337180b22186170706c69636174696f6e2f6f637465742d73747265616d32303f3b7f11e1ab2ce9c763196d320ec2b73bb7a9acad3f98cea94a37ccce30caa28bba70bb3931d521865c614e9012d88e6d7576a914e88e2124fffc9da0cfd28a92a92670443b4376b188ace0b46217000000001976a9143347a928ed9f8ad71955c09ecfa305efe4590cbe88ac00000000\",\n \"inputs\": [\n {\n \"address\": \"mgTdmr4kSe4jjBaQZwE3ar4Kb7XcZBqmZT\",\n \"amount\": \"4.947555\",\n \"confirmations\": 4,\n \"height\": 215,\n \"is_change\": true,\n \"is_mine\": true,\n \"nout\": 1,\n \"timestamp\": 1561485090,\n \"txid\": \"62a6d649879ce6a35a33265b8a9421faf24fd1e40457fdcdb4753d7eb7de6e0f\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"n2ibKtRbM8hdvp5EafkSAHBxbpBJ2CWWEV\",\n \"amount\": \"1.0\",\n \"claim_id\": \"74c583fc2e08061d6c32152cbdb86b09c483d3fc\",\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#74c583fc2e08061d6c32152cbdb86b09c483d3fc\",\n \"timestamp\": null,\n \"txid\": \"075ecb8118f2fe73a34683b574bb1be7a13d915ab14f3917a72c1d7e57abca1a\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpj0rdjqc7\",\n \"sd_hash\": \"3f3b7f11e1ab2ce9c763196d320ec2b73bb7a9acad3f98cea94a37ccce30caa28bba70bb3931d521865c614e9012d88e\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"value_type\": \"stream\"\n },\n {\n \"address\": \"mkC6bv4hVXEKkjYzbHrZAJ6iZxHU7kyspa\",\n \"amount\": \"3.923448\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 1,\n \"timestamp\": null,\n \"txid\": \"075ecb8118f2fe73a34683b574bb1be7a13d915ab14f3917a72c1d7e57abca1a\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.024107\",\n \"total_input\": \"4.947555\",\n \"total_output\": \"4.923448\",\n \"txid\": \"075ecb8118f2fe73a34683b574bb1be7a13d915ab14f3917a72c1d7e57abca1a\"\n }\n}"
|
||||
"curl": "curl -d'{\"method\": \"publish\", \"params\": {\"name\": \"a-new-stream\", \"bid\": \"1.0\", \"file_path\": \"/tmp/tmplnj7g2og\", \"tags\": [], \"languages\": [], \"locations\": [], \"channel_account_id\": [], \"preview\": false}}' http://localhost:5279/",
|
||||
"lbrynet": "lbrynet publish a-new-stream --bid=1.0 --file_path=/tmp/tmplnj7g2og",
|
||||
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"publish\", \"params\": {\"name\": \"a-new-stream\", \"bid\": \"1.0\", \"file_path\": \"/tmp/tmplnj7g2og\", \"tags\": [], \"languages\": [], \"locations\": [], \"channel_account_id\": [], \"preview\": false}}).json()",
|
||||
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"01000000012889d1e46c544984302aba136dec017885e0586e38b7801486a41905dcd4aa5f010000006a4730440220414a3a00018fc702da22da84e174e2d6e9bd5bcc16d5266cd9dfebc8039fb7c902205a14787a36f74952faee19f4cfb998706c141bffd1e2700941a7ca4e6f1509e1012102a3da85d6f33252605514d4d8be77cc3563e4018cdbdfa5fabb0c8453b49d543effffffff0200e1f50500000000bfb50c612d6e65772d73747265616d4c94000a90010a8d010a30fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd120b746d706c6e6a3767326f67180b22186170706c69636174696f6e2f6f637465742d73747265616d3230d9b627887a6586daaf55ac395c6826fa372110ced12e01009cf220c9a8a17b7b1b1f1f69e111fda7521e0ccc417e04df6d7576a9148d62b4efdc3423fcd5e5e8d5d414515e06a2f3cc88ace0b46217000000001976a91490b301d61740d27d2f038e9541627e6443378faf88ac00000000\",\n \"inputs\": [\n {\n \"address\": \"msym2SzDUdoUTAXGYttaZ3y6q3zkZ3Rhxw\",\n \"amount\": \"4.947555\",\n \"confirmations\": 4,\n \"height\": 215,\n \"is_change\": true,\n \"is_mine\": true,\n \"nout\": 1,\n \"timestamp\": 1559011814,\n \"txid\": \"5faad4dc0519a4861480b7386e58e0857801ec6d13ba2a308449546ce4d18928\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"mtQXpNQ924yoKNgVCycikXQA9oyBUYnBKL\",\n \"amount\": \"1.0\",\n \"claim_id\": \"cc8839262a966ca7c4855443144ff72dd1cb7be6\",\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#cc8839262a966ca7c4855443144ff72dd1cb7be6\",\n \"timestamp\": null,\n \"txid\": \"3208677665c12658b28081ceb4aedf6bda0518b244c9b1729148302677bda266\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmplnj7g2og\",\n \"sd_hash\": \"d9b627887a6586daaf55ac395c6826fa372110ced12e01009cf220c9a8a17b7b1b1f1f69e111fda7521e0ccc417e04df\",\n \"size\": \"11\"\n }\n },\n \"value_type\": \"stream\"\n },\n {\n \"address\": \"mti43KAeW7RJZxK1zDJVgcYJzUNL3Jqvwv\",\n \"amount\": \"3.923448\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 1,\n \"timestamp\": null,\n \"txid\": \"3208677665c12658b28081ceb4aedf6bda0518b244c9b1729148302677bda266\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.024107\",\n \"total_input\": \"4.947555\",\n \"total_output\": \"4.923448\",\n \"txid\": \"3208677665c12658b28081ceb4aedf6bda0518b244c9b1729148302677bda266\"\n }\n}"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -235,10 +229,10 @@
|
||||
"examples": [
|
||||
{
|
||||
"title": "Resolve a claim",
|
||||
"curl": "curl -d'{\"method\": \"resolve\", \"params\": {\"urls\": [\"astream#5d64500fb723eded83a41b0d5055f1783f019191\"]}}' http://localhost:5279/",
|
||||
"lbrynet": "lbrynet resolve astream#5d64500fb723eded83a41b0d5055f1783f019191",
|
||||
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"resolve\", \"params\": {\"urls\": [\"astream#5d64500fb723eded83a41b0d5055f1783f019191\"]}}).json()",
|
||||
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"astream#5d64500fb723eded83a41b0d5055f1783f019191\": {\n \"address\": \"mpDcDEwvfvETWqTDhddKLTzZZS2GBQWBqC\",\n \"amount\": \"1.0\",\n \"canonical_url\": \"lbry://@channel#7/astream#5\",\n \"claim_id\": \"5d64500fb723eded83a41b0d5055f1783f019191\",\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\": 1561485090,\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#5d64500fb723eded83a41b0d5055f1783f019191\",\n \"short_url\": \"lbry://astream#5\",\n \"signing_channel\": {\n \"address\": \"n3rBuPQB9qzAha4xU1uHyP5nmvR3WGq3r6\",\n \"amount\": \"1.0\",\n \"canonical_url\": \"lbry://@channel#7\",\n \"claim_id\": \"7ed794458d57978c49572424e1d32c7fa4d5325e\",\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\": 1561485089,\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#7ed794458d57978c49572424e1d32c7fa4d5325e\",\n \"short_url\": \"lbry://@channel#7\",\n \"timestamp\": 1561485089,\n \"txid\": \"0f7256329d0b2896d6f2472eea2614fbcf20ab6b22e27d168060ebb0adbaa6fa\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a0342000465bebc31803d2a7f0f037f696665d4d610abea2e518f906410163dec7513fc2b9a82ae0c4a15602f467d4c03823d72cf95c36fc6a87e963356e44db502027ae2\",\n \"public_key_id\": \"mrqYtVaoPEPqgyRPExUPi7PrYJ9nDc59yW\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n },\n \"timestamp\": 1561485090,\n \"txid\": \"dac2f1adaf5debd8cb377673b35ee4e6eb62ba7747b4440ffdb44d6875c2197e\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpzj1qbxfj\",\n \"sd_hash\": \"d85e47456630442a413f6cbedbdc4b0a5177770155d8a4523bbf2f301ebae95e0785cb475ca8d1a9d3cab54a05de64d3\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"value_type\": \"stream\"\n }\n }\n}"
|
||||
"curl": "curl -d'{\"method\": \"resolve\", \"params\": {\"urls\": [\"astream#ffdbe8f44f285fbc4a352763727abd86d17399c1\"]}}' http://localhost:5279/",
|
||||
"lbrynet": "lbrynet resolve astream#ffdbe8f44f285fbc4a352763727abd86d17399c1",
|
||||
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"resolve\", \"params\": {\"urls\": [\"astream#ffdbe8f44f285fbc4a352763727abd86d17399c1\"]}}).json()",
|
||||
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"astream#ffdbe8f44f285fbc4a352763727abd86d17399c1\": {\n \"address\": \"mg5Gn2NmJFVpZUU1ScVKf34KXVmJsrxXeu\",\n \"amount\": \"1.0\",\n \"canonical_url\": \"lbry://@channel#6/astream#f\",\n \"claim_id\": \"ffdbe8f44f285fbc4a352763727abd86d17399c1\",\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\": 1559011814,\n \"effective_amount\": \"1.0\",\n \"expiration_height\": 263187,\n \"is_controlling\": true,\n \"support_amount\": \"0.0\",\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#ffdbe8f44f285fbc4a352763727abd86d17399c1\",\n \"short_url\": \"lbry://astream#f\",\n \"signing_channel\": {\n \"address\": \"muK7TZrirA8yHzxFcXa51W7CjxbAho2Zua\",\n \"amount\": \"1.0\",\n \"canonical_url\": \"lbry://@channel#6\",\n \"claim_id\": \"682bdf7e3ea6564bcf8aebe3cf227544189d1a6d\",\n \"claim_op\": \"update\",\n \"confirmations\": 7,\n \"height\": 210,\n \"meta\": {\n \"activation_height\": 209,\n \"claims_in_channel\": 2,\n \"creation_height\": 209,\n \"creation_timestamp\": 1559011813,\n \"effective_amount\": \"1.0\",\n \"expiration_height\": 263183,\n \"is_controlling\": true,\n \"support_amount\": \"0.0\",\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#682bdf7e3ea6564bcf8aebe3cf227544189d1a6d\",\n \"short_url\": \"lbry://@channel#6\",\n \"timestamp\": 1559011813,\n \"txid\": \"3f665f0ca3cbb19c3c75813a30cd8334d7738a20566f2aa7775ab024d6fedd64\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004eeccdcff00c8336c5d616fee009894e5cbbc2bbf9497021aabbde81beaf8e6edf423de4ff094a8d4e7ea87d9469fd7d3b834b80d9b330d2f7a887108c5ea9268\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n },\n \"timestamp\": 1559011814,\n \"txid\": \"fa78db71b5e4205ec33a69106f9c9528ed9289fa3f8efc51baebe6e514247287\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmp6h32p99s\",\n \"sd_hash\": \"e38f25767c7619948832380b12def270aa244ee0b712020551198b2c587babb08583b7ad928ea08f71e1a6ced74836e0\",\n \"size\": \"11\"\n }\n },\n \"value_type\": \"stream\"\n }\n }\n}"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -253,14 +247,14 @@
|
||||
"name": "status",
|
||||
"description": "Get daemon status",
|
||||
"arguments": [],
|
||||
"returns": "(dict) lbrynet-daemon status\n {\n 'installation_id': (str) installation id - base58,\n 'is_running': (bool),\n 'skipped_components': (list) [names of skipped components (str)],\n 'startup_status': { Does not include components which have been skipped\n 'blob_manager': (bool),\n 'blockchain_headers': (bool),\n 'database': (bool),\n 'dht': (bool),\n 'exchange_rate_manager': (bool),\n 'hash_announcer': (bool),\n 'peer_protocol_server': (bool),\n 'stream_manager': (bool),\n 'upnp': (bool),\n 'wallet': (bool),\n },\n 'connection_status': {\n 'code': (str) connection status code,\n 'message': (str) connection status message\n },\n 'blockchain_headers': {\n 'downloading_headers': (bool),\n 'download_progress': (float) 0-100.0\n },\n 'wallet': {\n 'blocks': (int) local blockchain height,\n 'blocks_behind': (int) remote_height - local_height,\n 'best_blockhash': (str) block hash of most recent block,\n 'is_encrypted': (bool),\n 'is_locked': (bool),\n },\n 'dht': {\n 'node_id': (str) lbry dht node id - hex encoded,\n 'peers_in_routing_table': (int) the number of peers in the routing table,\n },\n 'blob_manager': {\n 'finished_blobs': (int) number of finished blobs in the blob manager,\n 'connections': {\n 'incoming_bps': {\n <source ip and tcp port>: (int) bytes per second received,\n },\n 'outgoing_bps': {\n <destination ip and tcp port>: (int) bytes per second sent,\n },\n 'total_outgoing_mps': (float) megabytes per second sent,\n 'total_incoming_mps': (float) megabytes per second received,\n 'time': (float) timestamp\n }\n },\n 'hash_announcer': {\n 'announce_queue_size': (int) number of blobs currently queued to be announced\n },\n 'stream_manager': {\n 'managed_files': (int) count of files in the stream manager,\n },\n 'upnp': {\n 'aioupnp_version': (str),\n 'redirects': {\n <TCP | UDP>: (int) external_port,\n },\n 'gateway': (str) manufacturer and model,\n 'dht_redirect_set': (bool),\n 'peer_redirect_set': (bool),\n 'external_ip': (str) external ip address,\n }\n }",
|
||||
"returns": "(dict) lbrynet-daemon status\n {\n 'installation_id': (str) installation id - base58,\n 'is_running': (bool),\n 'skipped_components': (list) [names of skipped components (str)],\n 'startup_status': { Does not include components which have been skipped\n 'blob_manager': (bool),\n 'blockchain_headers': (bool),\n 'database': (bool),\n 'dht': (bool),\n 'exchange_rate_manager': (bool),\n 'hash_announcer': (bool),\n 'peer_protocol_server': (bool),\n 'stream_manager': (bool),\n 'upnp': (bool),\n 'wallet': (bool),\n },\n 'connection_status': {\n 'code': (str) connection status code,\n 'message': (str) connection status message\n },\n 'blockchain_headers': {\n 'downloading_headers': (bool),\n 'download_progress': (float) 0-100.0\n },\n 'wallet': {\n 'blocks': (int) local blockchain height,\n 'blocks_behind': (int) remote_height - local_height,\n 'best_blockhash': (str) block hash of most recent block,\n 'is_encrypted': (bool),\n 'is_locked': (bool),\n },\n 'dht': {\n 'node_id': (str) lbry dht node id - hex encoded,\n 'peers_in_routing_table': (int) the number of peers in the routing table,\n },\n 'blob_manager': {\n 'finished_blobs': (int) number of finished blobs in the blob manager,\n },\n 'hash_announcer': {\n 'announce_queue_size': (int) number of blobs currently queued to be announced\n },\n 'stream_manager': {\n 'managed_files': (int) count of files in the stream manager,\n },\n 'upnp': {\n 'aioupnp_version': (str),\n 'redirects': {\n <TCP | UDP>: (int) external_port,\n },\n 'gateway': (str) manufacturer and model,\n 'dht_redirect_set': (bool),\n 'peer_redirect_set': (bool),\n 'external_ip': (str) external ip address,\n }\n }",
|
||||
"examples": [
|
||||
{
|
||||
"title": "Get status",
|
||||
"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\": 174753.638136067,\n \"total_incoming_mbs\": 0.0,\n \"total_outgoing_mbs\": 0.0\n },\n \"finished_blobs\": 0\n },\n \"connection_status\": {\n \"code\": \"connected\",\n \"message\": \"No connection problems detected\"\n },\n \"installation_id\": \"8pS8Qp6ZV2azEgMT9MqurqFyEhGFgtR8L8UEbYbdGnCyvSrWEDU3ND4UZKG2iSzQ1f\",\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\": \"c432cf5e38130f7a6611b18078d8a4160c20481122e34b53c6e26e4831bc06c2\",\n \"blocks\": 206,\n \"blocks_behind\": 0,\n \"is_encrypted\": false,\n \"is_locked\": false\n }\n }\n}"
|
||||
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"blob_manager\": {\n \"finished_blobs\": 0\n },\n \"connection_status\": {\n \"code\": \"connected\",\n \"message\": \"No connection problems detected\"\n },\n \"installation_id\": \"7gjXaLg5SLVuajoAqAUmeXpMgtxbFFiP2zKLKZqHjDpFdFijPEYEvBXxrLMocHHcFD\",\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\": \"e03fe663d3d7b14c5608ec36cc0d80639d7dd418b0f4fcadeb8353296b54896e\",\n \"blocks\": 206,\n \"blocks_behind\": 0,\n \"is_encrypted\": false,\n \"is_locked\": false\n }\n }\n}"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -275,14 +269,14 @@
|
||||
"name": "version",
|
||||
"description": "Get lbrynet API server version information",
|
||||
"arguments": [],
|
||||
"returns": "(dict) Dictionary of lbry version information\n {\n 'processor': (str) processor type,\n 'python_version': (str) python version,\n 'platform': (str) platform string,\n 'os_release': (str) os release string,\n 'os_system': (str) os name,\n 'lbrynet_version': (str) lbrynet version,\n 'torba_version': (str) torba version,\n 'build': (str) \"dev\" | \"qa\" | \"rc\" | \"release\",\n }",
|
||||
"returns": "(dict) Dictionary of lbry version information\n {\n 'build': (str) build type (e.g. \"dev\", \"rc\", \"release\"),\n 'ip': (str) remote ip, if available,\n 'lbrynet_version': (str) lbrynet_version,\n 'lbryum_version': (str) lbryum_version,\n 'lbryschema_version': (str) lbryschema_version,\n 'os_release': (str) os release string\n 'os_system': (str) os name\n 'platform': (str) platform string\n 'processor': (str) processor type,\n 'python_version': (str) python version,\n }",
|
||||
"examples": [
|
||||
{
|
||||
"title": "Get version",
|
||||
"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.0rc10\",\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.3\",\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.38.0rc2\",\n \"os_release\": \"4.4.0-116-generic\",\n \"os_system\": \"Linux\",\n \"platform\": \"Linux-4.4.0-116-generic-x86_64-with-Ubuntu-16.04-xenial\",\n \"processor\": \"x86_64\",\n \"python_version\": \"3.7.2\"\n }\n}"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -330,10 +324,10 @@
|
||||
"examples": [
|
||||
{
|
||||
"title": "Add an account from seed",
|
||||
"curl": "curl -d'{\"method\": \"account_add\", \"params\": {\"account_name\": \"new account\", \"seed\": \"admit whisper prosper true example brown sea sketch clarify pudding hen faith\", \"single_key\": false}}' http://localhost:5279/",
|
||||
"lbrynet": "lbrynet account add \"new account\" --seed=\"admit whisper prosper true example brown sea sketch clarify pudding hen faith\"",
|
||||
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"account_add\", \"params\": {\"account_name\": \"new account\", \"seed\": \"admit whisper prosper true example brown sea sketch clarify pudding hen faith\", \"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\": \"mjy1nohNLnCRF9mcGM13RHwm4fPwp6hZDk\",\n \"is_default\": false,\n \"ledger\": \"lbc_regtest\",\n \"modified_on\": 1561485056.9625015,\n \"name\": \"new account\",\n \"private_key\": \"tprv8ZgxMBicQKsPfK8PpjVn9CX9dQbHu5cRhD6AB8kLNqJf7gckQYNRvtC4xawA34xQ7yQnUHkd6jwHCkZHVuY3s897sKyBHGGGWg8tokKkASU\",\n \"public_key\": \"tpubD6NzVbkrYhZ4YnABiPANYcBGCS7E4QoLGWgwTendo773xAsX2wC27Now8iQZ2kKbSq6GUaSDTV714e3Qxfdwsqh1dnYwbzUboTCqBSZ53gg\",\n \"seed\": \"admit whisper prosper true example brown sea sketch clarify pudding hen faith\"\n }\n}"
|
||||
"curl": "curl -d'{\"method\": \"account_add\", \"params\": {\"account_name\": \"new account\", \"seed\": \"fetch ripple echo rabbit taxi emerge make tape front issue seven pilot\", \"single_key\": false}}' http://localhost:5279/",
|
||||
"lbrynet": "lbrynet account add \"new account\" --seed=\"fetch ripple echo rabbit taxi emerge make tape front issue seven pilot\"",
|
||||
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"account_add\", \"params\": {\"account_name\": \"new account\", \"seed\": \"fetch ripple echo rabbit taxi emerge make tape front issue seven pilot\", \"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\": \"mmiprM3BwUmzyB7ebMmL6GCE1YFw3TGk5W\",\n \"is_default\": false,\n \"ledger\": \"lbc_regtest\",\n \"modified_on\": 1559011780.6249187,\n \"name\": \"new account\",\n \"private_key\": \"tprv8ZgxMBicQKsPdnBkyQuCYYRiWPCqBbNSqxZDDKeTUBiht5vDSVmV7P7ttPGxWMiiQKgLHfv2TegdUUJeXkNrVrQWdcTQ3YADKsyaiyQrqg1\",\n \"public_key\": \"tpubD6NzVbkrYhZ4XFDYs4Znwx5q5QimLvZMRG9zVqgktTX6iaAz4tb5Hsjm4XHeqm2Vxzjz4XwgtdtF39REpXRV4E284pkvcubqiYABzSrXiGr\",\n \"seed\": \"fetch ripple echo rabbit taxi emerge make tape front issue seven pilot\"\n }\n}"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -365,9 +359,9 @@
|
||||
},
|
||||
{
|
||||
"title": "Get balance for specific account by id",
|
||||
"curl": "curl -d'{\"method\": \"account_balance\", \"params\": {\"account_id\": \"mjy1nohNLnCRF9mcGM13RHwm4fPwp6hZDk\"}}' http://localhost:5279/",
|
||||
"lbrynet": "lbrynet account balance \"mjy1nohNLnCRF9mcGM13RHwm4fPwp6hZDk\"",
|
||||
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"account_balance\", \"params\": {\"account_id\": \"mjy1nohNLnCRF9mcGM13RHwm4fPwp6hZDk\"}}).json()",
|
||||
"curl": "curl -d'{\"method\": \"account_balance\", \"params\": {\"account_id\": \"mmiprM3BwUmzyB7ebMmL6GCE1YFw3TGk5W\"}}' http://localhost:5279/",
|
||||
"lbrynet": "lbrynet account balance \"mmiprM3BwUmzyB7ebMmL6GCE1YFw3TGk5W\"",
|
||||
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"account_balance\", \"params\": {\"account_id\": \"mmiprM3BwUmzyB7ebMmL6GCE1YFw3TGk5W\"}}).json()",
|
||||
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": \"2.0\"\n}"
|
||||
}
|
||||
]
|
||||
@@ -396,7 +390,7 @@
|
||||
"curl": "curl -d'{\"method\": \"account_create\", \"params\": {\"account_name\": \"generated account\", \"single_key\": false}}' http://localhost:5279/",
|
||||
"lbrynet": "lbrynet account create \"generated account\"",
|
||||
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"account_create\", \"params\": {\"account_name\": \"generated account\", \"single_key\": false}}).json()",
|
||||
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"address_generator\": {\n \"change\": {\n \"gap\": 6,\n \"maximum_uses_per_address\": 1\n },\n \"name\": \"deterministic-chain\",\n \"receiving\": {\n \"gap\": 20,\n \"maximum_uses_per_address\": 1\n }\n },\n \"encrypted\": false,\n \"id\": \"mjy1nohNLnCRF9mcGM13RHwm4fPwp6hZDk\",\n \"is_default\": false,\n \"ledger\": \"lbc_regtest\",\n \"modified_on\": 1561485056.7929218,\n \"name\": \"generated account\",\n \"private_key\": \"tprv8ZgxMBicQKsPfK8PpjVn9CX9dQbHu5cRhD6AB8kLNqJf7gckQYNRvtC4xawA34xQ7yQnUHkd6jwHCkZHVuY3s897sKyBHGGGWg8tokKkASU\",\n \"public_key\": \"tpubD6NzVbkrYhZ4YnABiPANYcBGCS7E4QoLGWgwTendo773xAsX2wC27Now8iQZ2kKbSq6GUaSDTV714e3Qxfdwsqh1dnYwbzUboTCqBSZ53gg\",\n \"seed\": \"admit whisper prosper true example brown sea sketch clarify pudding hen faith\"\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\": \"mmiprM3BwUmzyB7ebMmL6GCE1YFw3TGk5W\",\n \"is_default\": false,\n \"ledger\": \"lbc_regtest\",\n \"modified_on\": 1559011780.4394753,\n \"name\": \"generated account\",\n \"private_key\": \"tprv8ZgxMBicQKsPdnBkyQuCYYRiWPCqBbNSqxZDDKeTUBiht5vDSVmV7P7ttPGxWMiiQKgLHfv2TegdUUJeXkNrVrQWdcTQ3YADKsyaiyQrqg1\",\n \"public_key\": \"tpubD6NzVbkrYhZ4XFDYs4Znwx5q5QimLvZMRG9zVqgktTX6iaAz4tb5Hsjm4XHeqm2Vxzjz4XwgtdtF39REpXRV4E284pkvcubqiYABzSrXiGr\",\n \"seed\": \"fetch ripple echo rabbit taxi emerge make tape front issue seven pilot\"\n }\n}"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -479,24 +473,24 @@
|
||||
"examples": [
|
||||
{
|
||||
"title": "Transfer 2 LBC from default account to specific account",
|
||||
"curl": "curl -d'{\"method\": \"account_fund\", \"params\": {\"to_account\": \"mjy1nohNLnCRF9mcGM13RHwm4fPwp6hZDk\", \"amount\": \"2.0\", \"everything\": false, \"broadcast\": true}}' http://localhost:5279/",
|
||||
"lbrynet": "lbrynet account fund --to_account=\"mjy1nohNLnCRF9mcGM13RHwm4fPwp6hZDk\" --amount=2.0 --broadcast",
|
||||
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"account_fund\", \"params\": {\"to_account\": \"mjy1nohNLnCRF9mcGM13RHwm4fPwp6hZDk\", \"amount\": \"2.0\", \"everything\": false, \"broadcast\": true}}).json()",
|
||||
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"0100000001c0fc2691a44442cb2c1b48a27518be2ec79230a771ef1a7d1c9ce9b4f293a08f010000006a47304402203f2685e9fa15bd431e61d659e3abbc2d900f2ef04c15c1864456b449c068f55902205505b654acada67b154179f6329516212f9cf3df7fb39636a286121e540f87a80121031370fc0bbc4f99acf402e5d687e846666cc0e5d7467c83104874e238c6ee6d2dffffffff0200c2eb0b000000001976a91469dd5873a711b516c47a0227efda9132a805bb0288ac90d7ae2f000000001976a914ea36761adfb298e01c377eeeb93e3a03874f6de588ac00000000\",\n \"inputs\": [\n {\n \"address\": \"mjnGbmHPAUrnF2VmUqeDAZsSMHWbdmpfJ5\",\n \"amount\": \"10.0\",\n \"confirmations\": 6,\n \"height\": 201,\n \"is_change\": false,\n \"is_mine\": true,\n \"nout\": 1,\n \"timestamp\": 1561485088,\n \"txid\": \"8fa093f2b4e99c1c7d1aef71a73092c72ebe1875a2481b2ccb4244a49126fcc0\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"mqAiQYyqiqVWXaEYapnu5P49cnLvQdh11s\",\n \"amount\": \"2.0\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 0,\n \"timestamp\": null,\n \"txid\": \"0e071fe12cfda37fb80dd634afb1a44bcb861e2de16009ad5628cc7f74776634\",\n \"type\": \"payment\"\n },\n {\n \"address\": \"n2sMeyyRYF5btHqQTa8Y5eitMZ6pGEKRoE\",\n \"amount\": \"7.999876\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 1,\n \"timestamp\": null,\n \"txid\": \"0e071fe12cfda37fb80dd634afb1a44bcb861e2de16009ad5628cc7f74776634\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.000124\",\n \"total_input\": \"10.0\",\n \"total_output\": \"9.999876\",\n \"txid\": \"0e071fe12cfda37fb80dd634afb1a44bcb861e2de16009ad5628cc7f74776634\"\n }\n}"
|
||||
"curl": "curl -d'{\"method\": \"account_fund\", \"params\": {\"to_account\": \"mmiprM3BwUmzyB7ebMmL6GCE1YFw3TGk5W\", \"amount\": \"2.0\", \"everything\": false, \"broadcast\": true}}' http://localhost:5279/",
|
||||
"lbrynet": "lbrynet account fund --to_account=\"mmiprM3BwUmzyB7ebMmL6GCE1YFw3TGk5W\" --amount=2.0 --broadcast",
|
||||
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"account_fund\", \"params\": {\"to_account\": \"mmiprM3BwUmzyB7ebMmL6GCE1YFw3TGk5W\", \"amount\": \"2.0\", \"everything\": false, \"broadcast\": true}}).json()",
|
||||
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"0100000001ffa0efb97cc0b1de40104c1efde557888f1d1671c33cf45cf8d4c64407af1747010000006b483045022100f2688e18f3fa85c9efb4cbe14b69ace71439342f24813a7354f259f631ebf382022019db036a72924429eae0c8a74a4069a843ce03943f2ab02eb0f487ac06fd90300121020c2a113a365b5c19849a4b0a970e5d9977b799102e75c6463f9c6e7738a5d289ffffffff0200c2eb0b000000001976a9147a5eb4b44204015136a92a491d80593cdc5d31fe88ac90d7ae2f000000001976a9141891436814e20ce99f77b091edd4cef6d50f1abb88ac00000000\",\n \"inputs\": [\n {\n \"address\": \"mu8naFDrK7nHd3a2yCWNEV74A6JmDYsbha\",\n \"amount\": \"10.0\",\n \"confirmations\": 6,\n \"height\": 201,\n \"is_change\": false,\n \"is_mine\": true,\n \"nout\": 1,\n \"timestamp\": 1559011812,\n \"txid\": \"4717af0744c6d4f85cf43cc371161d8f8857e5fd1e4c1040deb1c07cb9efa0ff\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"mrfzBjhGDZoCmVeyQ32ryiQ6XbsoaH58uA\",\n \"amount\": \"2.0\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 0,\n \"timestamp\": null,\n \"txid\": \"3ef83205dd764152fc6847fc9c80b94251b5306152d0747d619f8da4e037145b\",\n \"type\": \"payment\"\n },\n {\n \"address\": \"mhkrXjG9n4C7EJyH4ooDVVTYm2cjzGZcxS\",\n \"amount\": \"7.999876\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 1,\n \"timestamp\": null,\n \"txid\": \"3ef83205dd764152fc6847fc9c80b94251b5306152d0747d619f8da4e037145b\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.000124\",\n \"total_input\": \"10.0\",\n \"total_output\": \"9.999876\",\n \"txid\": \"3ef83205dd764152fc6847fc9c80b94251b5306152d0747d619f8da4e037145b\"\n }\n}"
|
||||
},
|
||||
{
|
||||
"title": "Spread LBC between multiple addresses",
|
||||
"curl": "curl -d'{\"method\": \"account_fund\", \"params\": {\"to_account\": \"mjy1nohNLnCRF9mcGM13RHwm4fPwp6hZDk\", \"from_account\": \"mjy1nohNLnCRF9mcGM13RHwm4fPwp6hZDk\", \"amount\": \"1.5\", \"everything\": false, \"outputs\": 2, \"broadcast\": true}}' http://localhost:5279/",
|
||||
"lbrynet": "lbrynet account fund --to_account=\"mjy1nohNLnCRF9mcGM13RHwm4fPwp6hZDk\" --from_account=\"mjy1nohNLnCRF9mcGM13RHwm4fPwp6hZDk\" --amount=1.5 --outputs=2 --broadcast",
|
||||
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"account_fund\", \"params\": {\"to_account\": \"mjy1nohNLnCRF9mcGM13RHwm4fPwp6hZDk\", \"from_account\": \"mjy1nohNLnCRF9mcGM13RHwm4fPwp6hZDk\", \"amount\": \"1.5\", \"everything\": false, \"outputs\": 2, \"broadcast\": true}}).json()",
|
||||
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"0100000001346677747fcc2856ad0960e12d1e86cb4ba4b1af34d60db87fa3fd2ce11f070e000000006b483045022100f03612c9d7c7e011b8f1cb72726cf1f4fb7b9841c0a353df3af355ce299b5ce2022049a9bd4e5c2708c8f13218610b30ad1948e742e6afb892c92ce6577aba44af6001210342bb0577c9c1f33257bcd8bfb791b3cf8f4dae24d37e0a2e17b8a8cc6d446a76ffffffff03c0687804000000001976a9148f7781bf51d1a0f5f75f498ebeb742c0b556cca388acc0687804000000001976a9148f7781bf51d1a0f5f75f498ebeb742c0b556cca388ac6cb9fa02000000001976a91426551ba83e54370b9bfe7e00f950d9b0e63bc40788ac00000000\",\n \"inputs\": [\n {\n \"address\": \"mqAiQYyqiqVWXaEYapnu5P49cnLvQdh11s\",\n \"amount\": \"2.0\",\n \"confirmations\": 1,\n \"height\": 207,\n \"is_change\": true,\n \"is_mine\": true,\n \"nout\": 0,\n \"timestamp\": 1561485089,\n \"txid\": \"0e071fe12cfda37fb80dd634afb1a44bcb861e2de16009ad5628cc7f74776634\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"mtbY5xxTz94srMVzLYHZQZvfDGCub8xfTR\",\n \"amount\": \"0.75\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 0,\n \"timestamp\": null,\n \"txid\": \"f3ecdfab319d402d18e3b83ecff474c80b787ac10b79d8542c81ed10040e6202\",\n \"type\": \"payment\"\n },\n {\n \"address\": \"mtbY5xxTz94srMVzLYHZQZvfDGCub8xfTR\",\n \"amount\": \"0.75\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 1,\n \"timestamp\": null,\n \"txid\": \"f3ecdfab319d402d18e3b83ecff474c80b787ac10b79d8542c81ed10040e6202\",\n \"type\": \"payment\"\n },\n {\n \"address\": \"mj1dvkfJo289BLRNevo2j7kiFsJcYSdQtv\",\n \"amount\": \"0.499859\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 2,\n \"timestamp\": null,\n \"txid\": \"f3ecdfab319d402d18e3b83ecff474c80b787ac10b79d8542c81ed10040e6202\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.000141\",\n \"total_input\": \"2.0\",\n \"total_output\": \"1.999859\",\n \"txid\": \"f3ecdfab319d402d18e3b83ecff474c80b787ac10b79d8542c81ed10040e6202\"\n }\n}"
|
||||
"curl": "curl -d'{\"method\": \"account_fund\", \"params\": {\"to_account\": \"mmiprM3BwUmzyB7ebMmL6GCE1YFw3TGk5W\", \"from_account\": \"mmiprM3BwUmzyB7ebMmL6GCE1YFw3TGk5W\", \"amount\": \"1.5\", \"everything\": false, \"outputs\": 2, \"broadcast\": true}}' http://localhost:5279/",
|
||||
"lbrynet": "lbrynet account fund --to_account=\"mmiprM3BwUmzyB7ebMmL6GCE1YFw3TGk5W\" --from_account=\"mmiprM3BwUmzyB7ebMmL6GCE1YFw3TGk5W\" --amount=1.5 --outputs=2 --broadcast",
|
||||
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"account_fund\", \"params\": {\"to_account\": \"mmiprM3BwUmzyB7ebMmL6GCE1YFw3TGk5W\", \"from_account\": \"mmiprM3BwUmzyB7ebMmL6GCE1YFw3TGk5W\", \"amount\": \"1.5\", \"everything\": false, \"outputs\": 2, \"broadcast\": true}}).json()",
|
||||
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"01000000015b1437e0a48d9f617d74d0526130b55142b9809cfc4768fc524176dd0532f83e000000006a47304402202e9880fa1cda60fbbac822ab39e296b814fbba4490541a4a3e7b23739b83fa0302202b618448620585842149285ee41fa449978e585742156e1bf158aff5e22413fd012102c522a7125129e491b7e86ff1ccf69e3aaab24e30413c8badc0a74e0c469c4d7effffffff03c0687804000000001976a91463447211521da66a083c7aa7cb13ad22a75dcf4488acc0687804000000001976a91463447211521da66a083c7aa7cb13ad22a75dcf4488ac6cb9fa02000000001976a9141a195f71b450e4d6c6a705904ae04c163b40236d88ac00000000\",\n \"inputs\": [\n {\n \"address\": \"mrfzBjhGDZoCmVeyQ32ryiQ6XbsoaH58uA\",\n \"amount\": \"2.0\",\n \"confirmations\": 1,\n \"height\": 207,\n \"is_change\": true,\n \"is_mine\": true,\n \"nout\": 0,\n \"timestamp\": 1559011813,\n \"txid\": \"3ef83205dd764152fc6847fc9c80b94251b5306152d0747d619f8da4e037145b\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"mpZqBj8pttN7xXQP9FkVfKRSAkGvDd16XD\",\n \"amount\": \"0.75\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 0,\n \"timestamp\": null,\n \"txid\": \"aab140aa385b00d3b0416905fc539a53b2b6a3d8786deefe483c3d92b7769323\",\n \"type\": \"payment\"\n },\n {\n \"address\": \"mpZqBj8pttN7xXQP9FkVfKRSAkGvDd16XD\",\n \"amount\": \"0.75\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 1,\n \"timestamp\": null,\n \"txid\": \"aab140aa385b00d3b0416905fc539a53b2b6a3d8786deefe483c3d92b7769323\",\n \"type\": \"payment\"\n },\n {\n \"address\": \"mhtxFybjayPc8V4W1AopRw4MiphNA94pHf\",\n \"amount\": \"0.499859\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 2,\n \"timestamp\": null,\n \"txid\": \"aab140aa385b00d3b0416905fc539a53b2b6a3d8786deefe483c3d92b7769323\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.000141\",\n \"total_input\": \"2.0\",\n \"total_output\": \"1.999859\",\n \"txid\": \"aab140aa385b00d3b0416905fc539a53b2b6a3d8786deefe483c3d92b7769323\"\n }\n}"
|
||||
},
|
||||
{
|
||||
"title": "Transfer all LBC to a specified account",
|
||||
"curl": "curl -d'{\"method\": \"account_fund\", \"params\": {\"from_account\": \"mjy1nohNLnCRF9mcGM13RHwm4fPwp6hZDk\", \"everything\": true, \"broadcast\": true}}' http://localhost:5279/",
|
||||
"lbrynet": "lbrynet account fund --from_account=\"mjy1nohNLnCRF9mcGM13RHwm4fPwp6hZDk\" --everything --broadcast",
|
||||
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"account_fund\", \"params\": {\"from_account\": \"mjy1nohNLnCRF9mcGM13RHwm4fPwp6hZDk\", \"everything\": true, \"broadcast\": true}}).json()",
|
||||
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"010000000302620e0410ed812c54d8790bc17a780bc874f4cf3eb8e3182d409d31abdfecf3000000006a4730440220294fb6a9c2e72a48559546018a47b9809b6203d6557087fcb67836b8912c85dd0220186097a96551a014bfd997884dfaa15b6988adae64b723e5add723727ff1298801210337b6117f3a5fc40820b936e4b228d2576ce2f9a70a91228f71e6a967592572fcffffffff02620e0410ed812c54d8790bc17a780bc874f4cf3eb8e3182d409d31abdfecf3010000006a47304402203e6012c10ce76236b3685202ef4fe9ae6ce24ffd2b7f5648af5ba88d9f3ac56b022009ced72bc1ae82bf89acc2abe0b8e850467dd2814d680fd8a81dffce02a54f0901210337b6117f3a5fc40820b936e4b228d2576ce2f9a70a91228f71e6a967592572fcffffffff02620e0410ed812c54d8790bc17a780bc874f4cf3eb8e3182d409d31abdfecf3020000006b483045022100c75caa1826ede730b253d751ebd2164d40c74fb4724bc7d4d9a200325fefe7e70220262c74bcfacb214aa781d80775e39d35a396c1dda4453ddb470fc6cc0c3fb3c101210296295f9ab2bff497ac1e64d012d45d4d48a8f3bc8e926febacfe1d5e1a9cd01effffffff015027eb0b000000001976a914d15a521046fc425e25444798485573df4d2401ba88ac00000000\",\n \"inputs\": [\n {\n \"address\": \"mtbY5xxTz94srMVzLYHZQZvfDGCub8xfTR\",\n \"amount\": \"0.75\",\n \"confirmations\": 1,\n \"height\": 208,\n \"is_change\": true,\n \"is_mine\": true,\n \"nout\": 0,\n \"timestamp\": 1561485089,\n \"txid\": \"f3ecdfab319d402d18e3b83ecff474c80b787ac10b79d8542c81ed10040e6202\",\n \"type\": \"payment\"\n },\n {\n \"address\": \"mtbY5xxTz94srMVzLYHZQZvfDGCub8xfTR\",\n \"amount\": \"0.75\",\n \"confirmations\": 1,\n \"height\": 208,\n \"is_change\": true,\n \"is_mine\": true,\n \"nout\": 1,\n \"timestamp\": 1561485089,\n \"txid\": \"f3ecdfab319d402d18e3b83ecff474c80b787ac10b79d8542c81ed10040e6202\",\n \"type\": \"payment\"\n },\n {\n \"address\": \"mj1dvkfJo289BLRNevo2j7kiFsJcYSdQtv\",\n \"amount\": \"0.499859\",\n \"confirmations\": 1,\n \"height\": 208,\n \"is_change\": true,\n \"is_mine\": true,\n \"nout\": 2,\n \"timestamp\": 1561485089,\n \"txid\": \"f3ecdfab319d402d18e3b83ecff474c80b787ac10b79d8542c81ed10040e6202\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"mzbuijFAnVGiEKWb9n24hcrUgdxauR3i83\",\n \"amount\": \"1.999604\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 0,\n \"timestamp\": null,\n \"txid\": \"c5e686d1617e9bc0ee1d4d14e1b7f211985db09c839e307a7876b1df1acfd15d\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.000255\",\n \"total_input\": \"1.999859\",\n \"total_output\": \"1.999604\",\n \"txid\": \"c5e686d1617e9bc0ee1d4d14e1b7f211985db09c839e307a7876b1df1acfd15d\"\n }\n}"
|
||||
"curl": "curl -d'{\"method\": \"account_fund\", \"params\": {\"from_account\": \"mmiprM3BwUmzyB7ebMmL6GCE1YFw3TGk5W\", \"everything\": true, \"broadcast\": true}}' http://localhost:5279/",
|
||||
"lbrynet": "lbrynet account fund --from_account=\"mmiprM3BwUmzyB7ebMmL6GCE1YFw3TGk5W\" --everything --broadcast",
|
||||
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"account_fund\", \"params\": {\"from_account\": \"mmiprM3BwUmzyB7ebMmL6GCE1YFw3TGk5W\", \"everything\": true, \"broadcast\": true}}).json()",
|
||||
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"0100000003239376b7923d3c48feee6d78d8a3b6b2539a53fc056941b0d3005b38aa40b1aa000000006a47304402202280f476c6c2e030288d6a914fd0a4f25f77a2412646d2221361cee7842d68280220703aa48ce200adfdb9b45fb05911b196d057c8c6416379d245245f032d91bea0012103aaef7f277b51328287432a89023a34fb96e70fd86bbe9cb0dc7b22024252b9cbffffffff239376b7923d3c48feee6d78d8a3b6b2539a53fc056941b0d3005b38aa40b1aa010000006a47304402201500191033e90af3d0523bcd0dc1bf0a2532b2e72dbf2208ec5f03a1d57f68a2022000ec7b41ff2cf20c4fa189d0c77ecab1482a1fc6f3d38e6161f661d8bb1ad0bd012103aaef7f277b51328287432a89023a34fb96e70fd86bbe9cb0dc7b22024252b9cbffffffff239376b7923d3c48feee6d78d8a3b6b2539a53fc056941b0d3005b38aa40b1aa020000006a47304402203729f79259485bf1f8b02a2e0fd47353792108c7424f8b03f30fba2ebf87796302200aa96711e5724a82c51ae049d3d427436ad4fb14ee5f97de5745249f5ae0623f012103de076de4afb59f23e8e7c3cb0f493a1835c59d684c7546ac93fea7bd1e3d2036ffffffff015027eb0b000000001976a914681c30baec28e2aa8d45a228f2a6af2e0a4fcec188ac00000000\",\n \"inputs\": [\n {\n \"address\": \"mpZqBj8pttN7xXQP9FkVfKRSAkGvDd16XD\",\n \"amount\": \"0.75\",\n \"confirmations\": 1,\n \"height\": 208,\n \"is_change\": true,\n \"is_mine\": true,\n \"nout\": 0,\n \"timestamp\": 1559011813,\n \"txid\": \"aab140aa385b00d3b0416905fc539a53b2b6a3d8786deefe483c3d92b7769323\",\n \"type\": \"payment\"\n },\n {\n \"address\": \"mpZqBj8pttN7xXQP9FkVfKRSAkGvDd16XD\",\n \"amount\": \"0.75\",\n \"confirmations\": 1,\n \"height\": 208,\n \"is_change\": true,\n \"is_mine\": true,\n \"nout\": 1,\n \"timestamp\": 1559011813,\n \"txid\": \"aab140aa385b00d3b0416905fc539a53b2b6a3d8786deefe483c3d92b7769323\",\n \"type\": \"payment\"\n },\n {\n \"address\": \"mhtxFybjayPc8V4W1AopRw4MiphNA94pHf\",\n \"amount\": \"0.499859\",\n \"confirmations\": 1,\n \"height\": 208,\n \"is_change\": true,\n \"is_mine\": true,\n \"nout\": 2,\n \"timestamp\": 1559011813,\n \"txid\": \"aab140aa385b00d3b0416905fc539a53b2b6a3d8786deefe483c3d92b7769323\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"mq1SLhoqW2g3qY1eGpcp2r5Xw1Vf19ocP8\",\n \"amount\": \"1.999604\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 0,\n \"timestamp\": null,\n \"txid\": \"92dae07b857907a41b24e4c1c2e007ef7b8f3ba3b21b936f5a8cdade2d5bafba\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.000255\",\n \"total_input\": \"1.999859\",\n \"total_output\": \"1.999604\",\n \"txid\": \"92dae07b857907a41b24e4c1c2e007ef7b8f3ba3b21b936f5a8cdade2d5bafba\"\n }\n}"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -536,7 +530,7 @@
|
||||
"curl": "curl -d'{\"method\": \"account_list\", \"params\": {\"include_claims\": false, \"show_seed\": false}}' http://localhost:5279/",
|
||||
"lbrynet": "lbrynet account list",
|
||||
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"account_list\", \"params\": {\"include_claims\": false, \"show_seed\": false}}).json()",
|
||||
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"lbc_regtest\": [\n {\n \"address_generator\": {\n \"change\": {\n \"gap\": 6,\n \"maximum_uses_per_address\": 1\n },\n \"name\": \"deterministic-chain\",\n \"receiving\": {\n \"gap\": 20,\n \"maximum_uses_per_address\": 1\n }\n },\n \"certificates\": 0,\n \"coins\": 10.0,\n \"encrypted\": false,\n \"id\": \"mvuCTbTWTnF7u2vh3raaxSuR8Rd4hPGqs9\",\n \"is_default\": true,\n \"name\": \"Account #mvuCTbTWTnF7u2vh3raaxSuR8Rd4hPGqs9\",\n \"public_key\": \"tpubD6NzVbkrYhZ4XQhwsZYqxyH3vVf4MHQoiF2xXS2xcmGC2Ejbvq5X7S3onhZhMH7c4pgbJiFPX8C36HWwFgHUaZygQeXKJWsyaAWWzYqWSJm\",\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\": \"mhfojdfZKX5A8gZhQro9JTAV9QfLoQtJXZ\",\n \"is_default\": true,\n \"name\": \"Account #mhfojdfZKX5A8gZhQro9JTAV9QfLoQtJXZ\",\n \"public_key\": \"tpubD6NzVbkrYhZ4WcFH7M2ECDxpFfvKSfXk45guPZKAYR9UmebhVusPrtM3qRwbk1P8caZds6fuJj3LNpL5whsk6hTboszKA4oRRXUdDbxqv7K\",\n \"satoshis\": 1000000000\n }\n ]\n }\n}"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -583,10 +577,10 @@
|
||||
"examples": [
|
||||
{
|
||||
"title": "Remove an account",
|
||||
"curl": "curl -d'{\"method\": \"account_remove\", \"params\": {\"account_id\": \"mjy1nohNLnCRF9mcGM13RHwm4fPwp6hZDk\"}}' http://localhost:5279/",
|
||||
"lbrynet": "lbrynet account remove mjy1nohNLnCRF9mcGM13RHwm4fPwp6hZDk",
|
||||
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"account_remove\", \"params\": {\"account_id\": \"mjy1nohNLnCRF9mcGM13RHwm4fPwp6hZDk\"}}).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\": \"mjy1nohNLnCRF9mcGM13RHwm4fPwp6hZDk\",\n \"is_default\": false,\n \"ledger\": \"lbc_regtest\",\n \"modified_on\": 1561485056.7929218,\n \"name\": \"generated account\",\n \"private_key\": \"tprv8ZgxMBicQKsPfK8PpjVn9CX9dQbHu5cRhD6AB8kLNqJf7gckQYNRvtC4xawA34xQ7yQnUHkd6jwHCkZHVuY3s897sKyBHGGGWg8tokKkASU\",\n \"public_key\": \"tpubD6NzVbkrYhZ4YnABiPANYcBGCS7E4QoLGWgwTendo773xAsX2wC27Now8iQZ2kKbSq6GUaSDTV714e3Qxfdwsqh1dnYwbzUboTCqBSZ53gg\",\n \"seed\": \"admit whisper prosper true example brown sea sketch clarify pudding hen faith\"\n }\n}"
|
||||
"curl": "curl -d'{\"method\": \"account_remove\", \"params\": {\"account_id\": \"mmiprM3BwUmzyB7ebMmL6GCE1YFw3TGk5W\"}}' http://localhost:5279/",
|
||||
"lbrynet": "lbrynet account remove mmiprM3BwUmzyB7ebMmL6GCE1YFw3TGk5W",
|
||||
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"account_remove\", \"params\": {\"account_id\": \"mmiprM3BwUmzyB7ebMmL6GCE1YFw3TGk5W\"}}).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\": \"mmiprM3BwUmzyB7ebMmL6GCE1YFw3TGk5W\",\n \"is_default\": false,\n \"ledger\": \"lbc_regtest\",\n \"modified_on\": 1559011780.4394753,\n \"name\": \"generated account\",\n \"private_key\": \"tprv8ZgxMBicQKsPdnBkyQuCYYRiWPCqBbNSqxZDDKeTUBiht5vDSVmV7P7ttPGxWMiiQKgLHfv2TegdUUJeXkNrVrQWdcTQ3YADKsyaiyQrqg1\",\n \"public_key\": \"tpubD6NzVbkrYhZ4XFDYs4Znwx5q5QimLvZMRG9zVqgktTX6iaAz4tb5Hsjm4XHeqm2Vxzjz4XwgtdtF39REpXRV4E284pkvcubqiYABzSrXiGr\",\n \"seed\": \"fetch ripple echo rabbit taxi emerge make tape front issue seven pilot\"\n }\n}"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -661,10 +655,10 @@
|
||||
"examples": [
|
||||
{
|
||||
"title": "Modify maximum number of times a change address can be reused",
|
||||
"curl": "curl -d'{\"method\": \"account_set\", \"params\": {\"account_id\": \"mjy1nohNLnCRF9mcGM13RHwm4fPwp6hZDk\", \"default\": false, \"change_max_uses\": 10}}' http://localhost:5279/",
|
||||
"lbrynet": "lbrynet account set mjy1nohNLnCRF9mcGM13RHwm4fPwp6hZDk --change_max_uses=10",
|
||||
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"account_set\", \"params\": {\"account_id\": \"mjy1nohNLnCRF9mcGM13RHwm4fPwp6hZDk\", \"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\": \"mjy1nohNLnCRF9mcGM13RHwm4fPwp6hZDk\",\n \"is_default\": false,\n \"ledger\": \"lbc_regtest\",\n \"modified_on\": 1561485057.0708687,\n \"name\": \"new account\",\n \"private_key\": \"tprv8ZgxMBicQKsPfK8PpjVn9CX9dQbHu5cRhD6AB8kLNqJf7gckQYNRvtC4xawA34xQ7yQnUHkd6jwHCkZHVuY3s897sKyBHGGGWg8tokKkASU\",\n \"public_key\": \"tpubD6NzVbkrYhZ4YnABiPANYcBGCS7E4QoLGWgwTendo773xAsX2wC27Now8iQZ2kKbSq6GUaSDTV714e3Qxfdwsqh1dnYwbzUboTCqBSZ53gg\",\n \"seed\": \"admit whisper prosper true example brown sea sketch clarify pudding hen faith\"\n }\n}"
|
||||
"curl": "curl -d'{\"method\": \"account_set\", \"params\": {\"account_id\": \"mmiprM3BwUmzyB7ebMmL6GCE1YFw3TGk5W\", \"default\": false, \"change_max_uses\": 10}}' http://localhost:5279/",
|
||||
"lbrynet": "lbrynet account set mmiprM3BwUmzyB7ebMmL6GCE1YFw3TGk5W --change_max_uses=10",
|
||||
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"account_set\", \"params\": {\"account_id\": \"mmiprM3BwUmzyB7ebMmL6GCE1YFw3TGk5W\", \"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\": \"mmiprM3BwUmzyB7ebMmL6GCE1YFw3TGk5W\",\n \"is_default\": false,\n \"ledger\": \"lbc_regtest\",\n \"modified_on\": 1559011780.6901715,\n \"name\": \"new account\",\n \"private_key\": \"tprv8ZgxMBicQKsPdnBkyQuCYYRiWPCqBbNSqxZDDKeTUBiht5vDSVmV7P7ttPGxWMiiQKgLHfv2TegdUUJeXkNrVrQWdcTQ3YADKsyaiyQrqg1\",\n \"public_key\": \"tpubD6NzVbkrYhZ4XFDYs4Znwx5q5QimLvZMRG9zVqgktTX6iaAz4tb5Hsjm4XHeqm2Vxzjz4XwgtdtF39REpXRV4E284pkvcubqiYABzSrXiGr\",\n \"seed\": \"fetch ripple echo rabbit taxi emerge make tape front issue seven pilot\"\n }\n}"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -714,9 +708,9 @@
|
||||
"examples": [
|
||||
{
|
||||
"title": "Check if address is mine",
|
||||
"curl": "curl -d'{\"method\": \"address_is_mine\", \"params\": {\"address\": \"mzPzDUvLyZUKv2LmQdMZAmd4ZNm1Xxgf1z\"}}' http://localhost:5279/",
|
||||
"lbrynet": "lbrynet address is_mine mzPzDUvLyZUKv2LmQdMZAmd4ZNm1Xxgf1z",
|
||||
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"address_is_mine\", \"params\": {\"address\": \"mzPzDUvLyZUKv2LmQdMZAmd4ZNm1Xxgf1z\"}}).json()",
|
||||
"curl": "curl -d'{\"method\": \"address_is_mine\", \"params\": {\"address\": \"mztwZDgaFUnDFbtkxN2VLszuoojQMc6tLQ\"}}' http://localhost:5279/",
|
||||
"lbrynet": "lbrynet address is_mine mztwZDgaFUnDFbtkxN2VLszuoojQMc6tLQ",
|
||||
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"address_is_mine\", \"params\": {\"address\": \"mztwZDgaFUnDFbtkxN2VLszuoojQMc6tLQ\"}}).json()",
|
||||
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": true\n}"
|
||||
}
|
||||
]
|
||||
@@ -751,14 +745,14 @@
|
||||
"curl": "curl -d'{\"method\": \"address_list\", \"params\": {}}' http://localhost:5279/",
|
||||
"lbrynet": "lbrynet address list",
|
||||
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"address_list\", \"params\": {}}).json()",
|
||||
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": [\n \"mjnGbmHPAUrnF2VmUqeDAZsSMHWbdmpfJ5\",\n \"mfsQtTpZgv9D1KzkgS6sgevuRD3TDpx4b8\",\n \"mpDcDEwvfvETWqTDhddKLTzZZS2GBQWBqC\",\n \"msaGdm9gRuVwbRPW47pL41hjuiT7xo2vRd\",\n \"n3rBuPQB9qzAha4xU1uHyP5nmvR3WGq3r6\",\n \"n2aKiEgh36nK3xLr4C5vZzvj7hEuMhJWdb\",\n \"mfq8BbdBew1SdWUsK49XT863YobqKVheDy\",\n \"mzPzDUvLyZUKv2LmQdMZAmd4ZNm1Xxgf1z\",\n \"miLhR5kJLGVqi5Ss2VKT2Nxt4fToriqtX2\",\n \"mvrHAPqKaFJUVYXSqQS9MLWN7EHdAWArGJ\",\n \"mzZTN3wcKyqfLHL1bFAgGTqryHrJJshHPV\",\n \"mjgAKEpQjZVjvYsdHoRiucG6HfgTZxbfnD\",\n \"mkMSb7uWUMdGAQ3pnXjDgofyiVibmy2zw2\",\n \"n2ibKtRbM8hdvp5EafkSAHBxbpBJ2CWWEV\",\n \"mkaiNK23LKyWQqUxCYvk8KT1Bf7F5kccBV\",\n \"mr8ttV21zxBiiYeyHtWNfVo3dkgqJ9XtgP\",\n \"mvxcVQv1fJQGkJgCHxpRr15BzqKmTn9Jp2\",\n \"mmDrz35MC54Gqs12sxC48LcSsZiD6GRjvJ\",\n \"mq8DfGaa1vkw89tVaEaEgsQoHnkQdfwXBr\",\n \"mi9uQeFBjKe4EFze4gHvLVm9REepjj2qEm\",\n \"moXzxEEXj4nhGhnozbGGFqGXdEzysbDMHJ\",\n \"mgTdmr4kSe4jjBaQZwE3ar4Kb7XcZBqmZT\",\n \"moLhFf1vkeMKeMG3DAP1RTvbHDqSXha11K\",\n \"n2sMeyyRYF5btHqQTa8Y5eitMZ6pGEKRoE\",\n \"n2FNDLjvbu4dnW6pCtGKJN87PttvCeBWsR\",\n \"mwhWukDANoke2ikBrkj8u3kFdRh5YM2Xv7\",\n \"mzEZcphSw5ZUrEN3MpYmqRCEPBRS8iN34w\"\n ]\n}"
|
||||
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": [\n \"myK1B8RLzPtaUehDF49F6GzpTNhZJwkuFK\",\n \"mq1SLhoqW2g3qY1eGpcp2r5Xw1Vf19ocP8\",\n \"mr89YuKptsJxtE7izrCoDCdNvLp9KR2EuB\",\n \"n4VUJCJpkWT2Twzhs2dwkSVsVHtDoDkbaH\",\n \"mhkrXjG9n4C7EJyH4ooDVVTYm2cjzGZcxS\",\n \"mnY3oi1Auwp7Cb4CQRGDLoKWwsARVzes45\",\n \"mu8naFDrK7nHd3a2yCWNEV74A6JmDYsbha\",\n \"mnvmas1S7DYha4g7RZeNey87u8nZvVA1xG\",\n \"mxJmDYvcN6kCTos9YRb34jBDmwo14iJmNM\",\n \"mucWfYmDAVZW715d2cite7oc2e8J5PKH4u\",\n \"mg5Gn2NmJFVpZUU1ScVKf34KXVmJsrxXeu\",\n \"mqdCHu4sTh3bZoSTyMwR62i5w3e6U9aBCA\",\n \"mhgGjVVY6kjrAxf2cz1ALfbst6CQhZ72qg\",\n \"n4jxQucHz4BhGRmGSQLakzfwsHd7sN8jwa\",\n \"mztwZDgaFUnDFbtkxN2VLszuoojQMc6tLQ\",\n \"mujvjSMLfTmCxG2gy3ZNpNCFF5A1eF7GuZ\",\n \"muK7TZrirA8yHzxFcXa51W7CjxbAho2Zua\",\n \"mtQXpNQ924yoKNgVCycikXQA9oyBUYnBKL\",\n \"mxEwCiv67J8e9VcwbEc78yGMYxcZfRejMD\",\n \"mtmdn9t48VsD44K6ABAbdDLU8bodawoM4v\",\n \"mrBf6FXC67KD1pgHSjoarmrJC7oiZiEAnN\",\n \"mmCir7XhwDNvcFyPcbbDjrbumrK7FW11rQ\",\n \"mzuNaFAu7QDBfhv5eUi1qxWqEf4FTSdZiV\",\n \"mym11qGHsvNt3esNGnPZ8xTuQDDdvzVLP4\",\n \"n3H19KHvnn5N6PKbVhZk4PM7kZYWbUW1jG\",\n \"mt1jLmH7uq5x4vnMd2Zqnpm4w7ckkdgDSr\",\n \"muiGAtEmv3D3AvhKxp6pxaiaYstNgkYBeS\"\n ]\n}"
|
||||
},
|
||||
{
|
||||
"title": "List addresses in specified account",
|
||||
"curl": "curl -d'{\"method\": \"address_list\", \"params\": {\"account_id\": \"mjy1nohNLnCRF9mcGM13RHwm4fPwp6hZDk\"}}' http://localhost:5279/",
|
||||
"lbrynet": "lbrynet address list --account_id=\"mjy1nohNLnCRF9mcGM13RHwm4fPwp6hZDk\"",
|
||||
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"address_list\", \"params\": {\"account_id\": \"mjy1nohNLnCRF9mcGM13RHwm4fPwp6hZDk\"}}).json()",
|
||||
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": [\n \"mkZ7dj4b1JzgEk1AbdaEKXRZMc3t1Qzz5s\",\n \"miLfQZNWVqDEDYz5fz2iKU9WryD883bsu3\",\n \"mkTBCWDfCkmBWY3GCxfPzLzv1nPrj42g9i\",\n \"mhxiYAHjBy565rG4utN5N7sqyfNedA8gMj\",\n \"mqAiQYyqiqVWXaEYapnu5P49cnLvQdh11s\",\n \"mfXqWw7JwDTjYS2RFPHQRRidRKh8kBQuDA\",\n \"mveVkYXt4i79j8LyVNmSQJRPbiC3D7qfUn\",\n \"n2FP55ZGxWni8yXXRkayaGtKjjCPgjosUg\",\n \"mjUP3SWW5xSQePxyvBJEojThw53p3stPGz\",\n \"mw9wNMarhPNHJZ3WpVYmQBwwSt6RHkKBaE\",\n \"mh7e4ooAELtxhKjtDLkw2GZMdefM8DSgWT\",\n \"mvQ8JJQ892fZugZNpKcQaTRry75GceWo41\",\n \"mySo8Q8qF66jan5ma2jsvkjjf7BNWyPUo8\",\n \"mppmfdJ3EwHNXRdf4qcEN48TQ2ydE9jjSH\",\n \"mwrS4yFmX5Na1cPRoQUWVBNhEpLh63Bn5j\",\n \"mqY3oET1RoUVT7VQPYjBX2atwbUZ43XSoT\",\n \"moCXqVgoM5EGyoxC9nZL6dkabSjE1TcTNu\",\n \"mvPxFaNfj6Ynp5bmVMtZzPiN27q8AvmmVS\",\n \"mr43PzgGuS1FxCbSjfKNdXsqxZV6hjawt3\",\n \"myuyATCL66mckzXzpiFzcFGQbzdYiQjLdt\",\n \"mrzft5H9sA6crxC7kzEUNBJiWzzAS3wKKH\",\n \"mnUVBfAM4BwEQq8fwJ7xuZgARrqkJwJhLc\",\n \"myvpjybXe9sV9bdAZX5uun7mk9tt8HDFrJ\",\n \"mvWm7QzWcD33rn5VZaQNzvWh89VZGYVpbd\",\n \"mzer6QqsQnsUZKYoCrrqVbQumXajXxbpzJ\",\n \"mhCtYeSBpXoQuEUitEeZjUpjRjje6LZmSL\"\n ]\n}"
|
||||
"curl": "curl -d'{\"method\": \"address_list\", \"params\": {\"account_id\": \"mmiprM3BwUmzyB7ebMmL6GCE1YFw3TGk5W\"}}' http://localhost:5279/",
|
||||
"lbrynet": "lbrynet address list --account_id=\"mmiprM3BwUmzyB7ebMmL6GCE1YFw3TGk5W\"",
|
||||
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"address_list\", \"params\": {\"account_id\": \"mmiprM3BwUmzyB7ebMmL6GCE1YFw3TGk5W\"}}).json()",
|
||||
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": [\n \"mtptR4d9LBAgrra7xcsYHCRbi2cAn2MZLf\",\n \"mrfzBjhGDZoCmVeyQ32ryiQ6XbsoaH58uA\",\n \"mpZqBj8pttN7xXQP9FkVfKRSAkGvDd16XD\",\n \"mhtxFybjayPc8V4W1AopRw4MiphNA94pHf\",\n \"mp4wnohKv6rBWD4aL8rMEmBDmVgGZRQnc8\",\n \"mn5TqvgEQdHbg2KhxQZ7bHNMZtYVLkVBSV\",\n \"mwF8k177yZy1nms1AP3r3g5WtK5p7XhpRo\",\n \"mkhUFcKjiKhEid5QS573QwL38RAQjCrwY2\",\n \"mwabsSQcxdRxw8QYBWaL81tmu6WSQniAVu\",\n \"mkUfoXesw8P3CuDo4UHBcAAtDTjgUyMXnU\",\n \"mkSkAys8sHRZjRpzYXT9yk7KnwgvagDSRE\",\n \"mskWQ4fPukRpC5fVdqEvaiHtBgujJdRsR8\",\n \"n3d5BjF1h8wGnkBahYrHZoVhb1qg51SB3D\",\n \"n4jzZeestt64jghEGrV4Ad5rUBnVLJhE3U\",\n \"mmWUHYyddFXus5yYJf4Rtpkdv8GpgK9hYT\",\n \"mjv7LQMFR8tGWcTwH5JzWsCUXwRAygbCLu\",\n \"mrSPmWUdBrRHx1nMAUN1J3PnqcRELgga4U\",\n \"mfhy3VFVwCTPshEp7QnUUrhYvh9uBpHhzF\",\n \"mvwGdyxVbSeNvrcdbws42Wuob2ix2FYYq3\",\n \"mwHJKytimnJUQn3R4z3oMvtxFe7bWR8Lhn\",\n \"mnSwZR1JqNNcmaQyvapZwbqLcD8iyTZ279\",\n \"muiVnmmz5DWGtSHyuHcgcM6f7Ho38utTu2\",\n \"n21oZjxk8F4VtaSjQPxzdD9iFj9cNFpjn4\",\n \"n1CPPg4ypsEJtYHnMi3HKEJoLNPkMVgTe9\",\n \"mzFAivojDpyFhZCMRadw6AcJZXUxBbVW8A\",\n \"mxs9r97CSAGCkzCVMcMk3ijT9uaGXQWxDY\"\n ]\n}"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -780,7 +774,7 @@
|
||||
"curl": "curl -d'{\"method\": \"address_unused\", \"params\": {}}' http://localhost:5279/",
|
||||
"lbrynet": "lbrynet address unused",
|
||||
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"address_unused\", \"params\": {}}).json()",
|
||||
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": \"mzPzDUvLyZUKv2LmQdMZAmd4ZNm1Xxgf1z\"\n}"
|
||||
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": \"mztwZDgaFUnDFbtkxN2VLszuoojQMc6tLQ\"\n}"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -830,10 +824,10 @@
|
||||
"examples": [
|
||||
{
|
||||
"title": "Delete a blob",
|
||||
"curl": "curl -d'{\"method\": \"blob_delete\", \"params\": {\"blob_hash\": \"d4595a73a829c2a567a25ee1fa7ced42ae4d2d5fccc19126f01b8518537a386b6d20d611b35278afe6a5e193a762cd8c\"}}' http://localhost:5279/",
|
||||
"lbrynet": "lbrynet blob delete d4595a73a829c2a567a25ee1fa7ced42ae4d2d5fccc19126f01b8518537a386b6d20d611b35278afe6a5e193a762cd8c",
|
||||
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"blob_delete\", \"params\": {\"blob_hash\": \"d4595a73a829c2a567a25ee1fa7ced42ae4d2d5fccc19126f01b8518537a386b6d20d611b35278afe6a5e193a762cd8c\"}}).json()",
|
||||
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": \"Deleted d4595a73a829c2a567a25ee1fa7ced42ae4d2d5fccc19126f01b8518537a386b6d20d611b35278afe6a5e193a762cd8c\"\n}"
|
||||
"curl": "curl -d'{\"method\": \"blob_delete\", \"params\": {\"blob_hash\": \"d087dd83169ac7553c3026d4f47e42a3f673aa6e0220eef7d6867f8d94460080f020e470b8b4d7df4a9d8e6981b0784c\"}}' http://localhost:5279/",
|
||||
"lbrynet": "lbrynet blob delete d087dd83169ac7553c3026d4f47e42a3f673aa6e0220eef7d6867f8d94460080f020e470b8b4d7df4a9d8e6981b0784c",
|
||||
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"blob_delete\", \"params\": {\"blob_hash\": \"d087dd83169ac7553c3026d4f47e42a3f673aa6e0220eef7d6867f8d94460080f020e470b8b4d7df4a9d8e6981b0784c\"}}).json()",
|
||||
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": \"Deleted d087dd83169ac7553c3026d4f47e42a3f673aa6e0220eef7d6867f8d94460080f020e470b8b4d7df4a9d8e6981b0784c\"\n}"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -911,7 +905,7 @@
|
||||
"curl": "curl -d'{\"method\": \"blob_list\", \"params\": {\"needed\": false, \"finished\": false}}' http://localhost:5279/",
|
||||
"lbrynet": "lbrynet blob list",
|
||||
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"blob_list\", \"params\": {\"needed\": false, \"finished\": false}}).json()",
|
||||
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": [\n \"d4595a73a829c2a567a25ee1fa7ced42ae4d2d5fccc19126f01b8518537a386b6d20d611b35278afe6a5e193a762cd8c\",\n \"609e824398f24b7420f1febfc04e1a237364e4ed00fe46a1e936c3ee4926717e4c86ba66708cb78cb1c0c9d68f488396\",\n \"d85e47456630442a413f6cbedbdc4b0a5177770155d8a4523bbf2f301ebae95e0785cb475ca8d1a9d3cab54a05de64d3\",\n \"29d60d4ba62d33a280f448584fd825539f794943625101bd633b63b8f83c2e378a62765ca2e1a05dd720e762881519c2\"\n ]\n}"
|
||||
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": [\n \"d087dd83169ac7553c3026d4f47e42a3f673aa6e0220eef7d6867f8d94460080f020e470b8b4d7df4a9d8e6981b0784c\",\n \"32340dbf239be75d656c8cc72165bc97b33c7897bcad3e32eda18beae71e63f3be034ed64f2091e46fea657917aa24d8\",\n \"e38f25767c7619948832380b12def270aa244ee0b712020551198b2c587babb08583b7ad928ea08f71e1a6ced74836e0\",\n \"a76d75a13ff15d946f929115e248dd411996abea4e1f37f73a72ba82fcd39a0dbbb3a3777e767984cd30e9eef2b68312\"\n ]\n}"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -986,10 +980,10 @@
|
||||
"examples": [
|
||||
{
|
||||
"title": "Abandon a channel claim",
|
||||
"curl": "curl -d'{\"method\": \"channel_abandon\", \"params\": {\"claim_id\": \"7ed794458d57978c49572424e1d32c7fa4d5325e\", \"preview\": false, \"blocking\": false}}' http://localhost:5279/",
|
||||
"lbrynet": "lbrynet channel abandon 7ed794458d57978c49572424e1d32c7fa4d5325e",
|
||||
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"channel_abandon\", \"params\": {\"claim_id\": \"7ed794458d57978c49572424e1d32c7fa4d5325e\", \"preview\": false, \"blocking\": false}}).json()",
|
||||
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"0100000001faa6baadb0eb6080167de2226bab20cffb1426ea2e47f2d696280b9d3256720f000000006a47304402205287bb4f85eeb0f38defe91a27b871ff1b7ac94cda6e9885109f9d5ed6e03939022055dcf9daad53f145f464b8e5f6def71d564f3ebc99f882e1a7b0cd5d022b3e4d0121020cd9a5a73e65c43d276d79901f21b22d09f3872e97a9311ea27908142217f6f7ffffffff0134b7f505000000001976a914d4c63445bfef987db896a7835c90728ab7eb598888ac00000000\",\n \"inputs\": [\n {\n \"address\": \"n3rBuPQB9qzAha4xU1uHyP5nmvR3WGq3r6\",\n \"amount\": \"1.0\",\n \"claim_id\": \"7ed794458d57978c49572424e1d32c7fa4d5325e\",\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#7ed794458d57978c49572424e1d32c7fa4d5325e\",\n \"timestamp\": 1561485089,\n \"txid\": \"0f7256329d0b2896d6f2472eea2614fbcf20ab6b22e27d168060ebb0adbaa6fa\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a0342000465bebc31803d2a7f0f037f696665d4d610abea2e518f906410163dec7513fc2b9a82ae0c4a15602f467d4c03823d72cf95c36fc6a87e963356e44db502027ae2\",\n \"public_key_id\": \"mrqYtVaoPEPqgyRPExUPi7PrYJ9nDc59yW\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"mzuzzC1LcwKoRaWEZcR2vcDaSxcakKTMR3\",\n \"amount\": \"0.999893\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 0,\n \"timestamp\": null,\n \"txid\": \"1384a1d6010d90d6d463cb63f1fe9b7cc8de70f62f62bf453c5a53cc05d85c22\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.000107\",\n \"total_input\": \"1.0\",\n \"total_output\": \"0.999893\",\n \"txid\": \"1384a1d6010d90d6d463cb63f1fe9b7cc8de70f62f62bf453c5a53cc05d85c22\"\n }\n}"
|
||||
"curl": "curl -d'{\"method\": \"channel_abandon\", \"params\": {\"claim_id\": \"682bdf7e3ea6564bcf8aebe3cf227544189d1a6d\", \"preview\": false, \"blocking\": false}}' http://localhost:5279/",
|
||||
"lbrynet": "lbrynet channel abandon 682bdf7e3ea6564bcf8aebe3cf227544189d1a6d",
|
||||
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"channel_abandon\", \"params\": {\"claim_id\": \"682bdf7e3ea6564bcf8aebe3cf227544189d1a6d\", \"preview\": false, \"blocking\": false}}).json()",
|
||||
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"010000000164ddfed624b05a77a72a6f56208a73d73483cd303a81753c9cb1cba30c5f663f000000006b483045022100b8d3305e1e4f4dbf8b6f1627f1d2612f0afb41f91365b1ae11c298c52ae8be0a02202f7a2e45342607900e1a2d46e7b7d54f7cab9cbc85a399a19fa65c1f59b02c450121022f03def56e0d77c0f19e1c8ae315abccbf761e76343f19324fc8d5e4e521716bffffffff0134b7f505000000001976a9143a3d7976ad928fc8579eac779c0cbc7e49a2958d88ac00000000\",\n \"inputs\": [\n {\n \"address\": \"muK7TZrirA8yHzxFcXa51W7CjxbAho2Zua\",\n \"amount\": \"1.0\",\n \"claim_id\": \"682bdf7e3ea6564bcf8aebe3cf227544189d1a6d\",\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#682bdf7e3ea6564bcf8aebe3cf227544189d1a6d\",\n \"timestamp\": 1559011813,\n \"txid\": \"3f665f0ca3cbb19c3c75813a30cd8334d7738a20566f2aa7775ab024d6fedd64\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004eeccdcff00c8336c5d616fee009894e5cbbc2bbf9497021aabbde81beaf8e6edf423de4ff094a8d4e7ea87d9469fd7d3b834b80d9b330d2f7a887108c5ea9268\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"mkpu8W1mArAiBb6aV5MfGd9Uo9wnhHFSBa\",\n \"amount\": \"0.999893\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 0,\n \"timestamp\": null,\n \"txid\": \"8bba7bc7a0d69d1a786de725c54a6ee8ce66b445a06d22345064b6558acec5de\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.000107\",\n \"total_input\": \"1.0\",\n \"total_output\": \"0.999893\",\n \"txid\": \"8bba7bc7a0d69d1a786de725c54a6ee8ce66b445a06d22345064b6558acec5de\"\n }\n}"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -1092,66 +1086,48 @@
|
||||
"type": "bool",
|
||||
"description": "do not broadcast the transaction",
|
||||
"is_required": false
|
||||
},
|
||||
{
|
||||
"name": "blocking",
|
||||
"type": "bool",
|
||||
"description": "wait until transaction is in mempool",
|
||||
"is_required": false
|
||||
}
|
||||
],
|
||||
"returns": " {\n \"txid\": \"hash of transaction in hex\",\n \"height\": \"block where transaction was recorded\",\n \"inputs\": [\n {\n \"txid\": \"hash of transaction in hex\",\n \"nout\": \"position in the transaction\",\n \"height\": \"block where transaction was recorded\",\n \"amount\": \"value of the txo as a decimal\",\n \"address\": \"address of who can spend the txo\",\n \"confirmations\": \"number of confirmed blocks\",\n \"is_change\": \"payment to change address, only available when it can be determined\",\n \"is_mine\": \"payment to one of your accounts, only available when it can be determined\",\n \"type\": \"one of 'claim', 'support' or 'payment'\",\n \"name\": \"when type is 'claim' or 'support', this is the claim name\",\n \"claim_id\": \"when type is 'claim' or 'support', this is the claim id\",\n \"claim_op\": \"when type is 'claim', this determines if it is 'create' or 'update'\",\n \"value\": \"when type is 'claim' or 'support' with payload, this is the decoded protobuf payload\",\n \"value_type\": \"determines the type of the 'value' field: 'channel', 'stream', etc\",\n \"protobuf\": \"hex encoded raw protobuf version of 'value' field\",\n \"permanent_url\": \"when type is 'claim' or 'support', this is the long permanent claim URL\",\n \"signing_channel\": \"for signed claims only, metadata of signing channel\",\n \"is_channel_signature_valid\": \"for signed claims only, whether signature is valid\"\n }\n ],\n \"outputs\": [\n {\n \"txid\": \"hash of transaction in hex\",\n \"nout\": \"position in the transaction\",\n \"height\": \"block where transaction was recorded\",\n \"amount\": \"value of the txo as a decimal\",\n \"address\": \"address of who can spend the txo\",\n \"confirmations\": \"number of confirmed blocks\",\n \"is_change\": \"payment to change address, only available when it can be determined\",\n \"is_mine\": \"payment to one of your accounts, only available when it can be determined\",\n \"type\": \"one of 'claim', 'support' or 'payment'\",\n \"name\": \"when type is 'claim' or 'support', this is the claim name\",\n \"claim_id\": \"when type is 'claim' or 'support', this is the claim id\",\n \"claim_op\": \"when type is 'claim', this determines if it is 'create' or 'update'\",\n \"value\": \"when type is 'claim' or 'support' with payload, this is the decoded protobuf payload\",\n \"value_type\": \"determines the type of the 'value' field: 'channel', 'stream', etc\",\n \"protobuf\": \"hex encoded raw protobuf version of 'value' field\",\n \"permanent_url\": \"when type is 'claim' or 'support', this is the long permanent claim URL\",\n \"signing_channel\": \"for signed claims only, metadata of signing channel\",\n \"is_channel_signature_valid\": \"for signed claims only, whether signature is valid\"\n }\n ],\n \"total_input\": \"sum of inputs as a decimal\",\n \"total_output\": \"sum of outputs, sans fee, as a decimal\",\n \"total_fee\": \"fee amount\",\n \"hex\": \"entire transaction encoded in hex\"\n }",
|
||||
"examples": [
|
||||
{
|
||||
"title": "Create a channel claim without metadata",
|
||||
"curl": "curl -d'{\"method\": \"channel_create\", \"params\": {\"name\": \"@channel\", \"bid\": \"1.0\", \"featured\": [], \"tags\": [], \"languages\": [], \"locations\": [], \"preview\": false, \"blocking\": false}}' http://localhost:5279/",
|
||||
"curl": "curl -d'{\"method\": \"channel_create\", \"params\": {\"name\": \"@channel\", \"bid\": \"1.0\", \"featured\": [], \"tags\": [], \"languages\": [], \"locations\": [], \"preview\": false}}' http://localhost:5279/",
|
||||
"lbrynet": "lbrynet channel create @channel 1.0",
|
||||
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"channel_create\", \"params\": {\"name\": \"@channel\", \"bid\": \"1.0\", \"featured\": [], \"tags\": [], \"languages\": [], \"locations\": [], \"preview\": false, \"blocking\": false}}).json()",
|
||||
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"0100000001346677747fcc2856ad0960e12d1e86cb4ba4b1af34d60db87fa3fd2ce11f070e010000006a4730440220183a3e4c2025f45b083bc970e3437fb3deb14891c2f877697c008d0f5ea8f482022049ac41eefb4c6700e39e78175c9c50f8133a2316663ec127cf4fb9d4aa8a30eb012102ca7e8b7efe7723f0a68d28f38c5b220af9e53f1bc2d344fb458ca527da67cf8affffffff0200e1f5050000000084b508406368616e6e656c4c5d00125a0a583056301006072a8648ce3d020106052b8104000a0342000465bebc31803d2a7f0f037f696665d4d610abea2e518f906410163dec7513fc2b9a82ae0c4a15602f467d4c03823d72cf95c36fc6a87e963356e44db502027ae26d7576a914f4f607e8d47646250a79cfc9e57059e6ca8bb56688acc462a029000000001976a91457f3a42422174d5eb185b5bf049869a01db287c988ac00000000\",\n \"inputs\": [\n {\n \"address\": \"n2sMeyyRYF5btHqQTa8Y5eitMZ6pGEKRoE\",\n \"amount\": \"7.999876\",\n \"confirmations\": 2,\n \"height\": 207,\n \"is_change\": true,\n \"is_mine\": true,\n \"nout\": 1,\n \"timestamp\": 1561485089,\n \"txid\": \"0e071fe12cfda37fb80dd634afb1a44bcb861e2de16009ad5628cc7f74776634\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"n3rBuPQB9qzAha4xU1uHyP5nmvR3WGq3r6\",\n \"amount\": \"1.0\",\n \"claim_id\": \"7ed794458d57978c49572424e1d32c7fa4d5325e\",\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#7ed794458d57978c49572424e1d32c7fa4d5325e\",\n \"timestamp\": null,\n \"txid\": \"50e9f458f59f7ddb51c13e956b178ac9457e00e36bddfe02f6f48079d3e3f896\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a0342000465bebc31803d2a7f0f037f696665d4d610abea2e518f906410163dec7513fc2b9a82ae0c4a15602f467d4c03823d72cf95c36fc6a87e963356e44db502027ae2\",\n \"public_key_id\": \"mrqYtVaoPEPqgyRPExUPi7PrYJ9nDc59yW\"\n },\n \"value_type\": \"channel\"\n },\n {\n \"address\": \"moXzxEEXj4nhGhnozbGGFqGXdEzysbDMHJ\",\n \"amount\": \"6.983769\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 1,\n \"timestamp\": null,\n \"txid\": \"50e9f458f59f7ddb51c13e956b178ac9457e00e36bddfe02f6f48079d3e3f896\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.016107\",\n \"total_input\": \"7.999876\",\n \"total_output\": \"7.983769\",\n \"txid\": \"50e9f458f59f7ddb51c13e956b178ac9457e00e36bddfe02f6f48079d3e3f896\"\n }\n}"
|
||||
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"channel_create\", \"params\": {\"name\": \"@channel\", \"bid\": \"1.0\", \"featured\": [], \"tags\": [], \"languages\": [], \"locations\": [], \"preview\": false}}).json()",
|
||||
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"01000000015b1437e0a48d9f617d74d0526130b55142b9809cfc4768fc524176dd0532f83e010000006b483045022100a3a998eda6a968a75a230ceb7712d745273e41c20b0573873ca75973048b37b9022039055db9b97a2517f4a81142a7be9fead9e2866c5946f8fdeeb7cbea93fee634012103382e6fef405ac1e202d4edea0888abfc8a9ec4e2ec499681a78b940d23a4cbaaffffffff0200e1f5050000000084b508406368616e6e656c4c5d00125a0a583056301006072a8648ce3d020106052b8104000a03420004eeccdcff00c8336c5d616fee009894e5cbbc2bbf9497021aabbde81beaf8e6edf423de4ff094a8d4e7ea87d9469fd7d3b834b80d9b330d2f7a887108c5ea92686d7576a91497546b4edcb94a6b0fcd8593ed3a942c92ca8d9988acc462a029000000001976a914681c30baec28e2aa8d45a228f2a6af2e0a4fcec188ac00000000\",\n \"inputs\": [\n {\n \"address\": \"mhkrXjG9n4C7EJyH4ooDVVTYm2cjzGZcxS\",\n \"amount\": \"7.999876\",\n \"confirmations\": 2,\n \"height\": 207,\n \"is_change\": true,\n \"is_mine\": true,\n \"nout\": 1,\n \"timestamp\": 1559011813,\n \"txid\": \"3ef83205dd764152fc6847fc9c80b94251b5306152d0747d619f8da4e037145b\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"muK7TZrirA8yHzxFcXa51W7CjxbAho2Zua\",\n \"amount\": \"1.0\",\n \"claim_id\": \"682bdf7e3ea6564bcf8aebe3cf227544189d1a6d\",\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#682bdf7e3ea6564bcf8aebe3cf227544189d1a6d\",\n \"timestamp\": null,\n \"txid\": \"1e6a8336442131461b92bdf3098baa01790df5a0d7d75bd1ab703744bc2ace9a\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004eeccdcff00c8336c5d616fee009894e5cbbc2bbf9497021aabbde81beaf8e6edf423de4ff094a8d4e7ea87d9469fd7d3b834b80d9b330d2f7a887108c5ea9268\"\n },\n \"value_type\": \"channel\"\n },\n {\n \"address\": \"mq1SLhoqW2g3qY1eGpcp2r5Xw1Vf19ocP8\",\n \"amount\": \"6.983769\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 1,\n \"timestamp\": null,\n \"txid\": \"1e6a8336442131461b92bdf3098baa01790df5a0d7d75bd1ab703744bc2ace9a\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.016107\",\n \"total_input\": \"7.999876\",\n \"total_output\": \"7.983769\",\n \"txid\": \"1e6a8336442131461b92bdf3098baa01790df5a0d7d75bd1ab703744bc2ace9a\"\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\", \"preview\": false, \"blocking\": false}}' http://localhost:5279/",
|
||||
"curl": "curl -d'{\"method\": \"channel_create\", \"params\": {\"name\": \"@bigchannel\", \"bid\": \"1.0\", \"title\": \"Big Channel\", \"description\": \"A channel with lots of videos.\", \"email\": \"creator@smallmedia.com\", \"website_url\": \"http://smallmedia.com\", \"featured\": [], \"tags\": [\"music\", \"art\"], \"languages\": [\"pt-BR\", \"uk\"], \"locations\": [\"BR\", \"UA::Kiyv\"], \"thumbnail_url\": \"http://smallmedia.com/logo.jpg\", \"cover_url\": \"http://smallmedia.com/logo.jpg\", \"preview\": false}}' http://localhost:5279/",
|
||||
"lbrynet": "lbrynet channel create @bigchannel 1.0 --title=\"Big Channel\" --description=\"A channel with lots of videos.\" --email=\"creator@smallmedia.com\" --tags=music --tags=art --languages=pt-BR --languages=uk --locations=BR --locations=UA::Kiyv --website_url=\"http://smallmedia.com\" --thumbnail_url=\"http://smallmedia.com/logo.jpg\" --cover_url=\"http://smallmedia.com/logo.jpg\"",
|
||||
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"channel_create\", \"params\": {\"name\": \"@bigchannel\", \"bid\": \"1.0\", \"title\": \"Big Channel\", \"description\": \"A channel with lots of videos.\", \"email\": \"creator@smallmedia.com\", \"website_url\": \"http://smallmedia.com\", \"featured\": [], \"tags\": [\"music\", \"art\"], \"languages\": [\"pt-BR\", \"uk\"], \"locations\": [\"BR\", \"UA::Kiyv\"], \"thumbnail_url\": \"http://smallmedia.com/logo.jpg\", \"cover_url\": \"http://smallmedia.com/logo.jpg\", \"preview\": false, \"blocking\": false}}).json()",
|
||||
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"0100000001faa6baadb0eb6080167de2226bab20cffb1426ea2e47f2d696280b9d3256720f010000006a473044022061957aa9e53c7588f10eaf460686fd02ac447f91a5f5fc69b010a509ba7d99d802207be2706dd40cf990811ea5e1484502e29510c8c0d0b2368a79b2c6186f3002c90121039e6825507996b2a26d8f13aa036b7beaf1688dfa8d1323224ce52154183d3164ffffffff0200e1f50500000000fd5001b50b406269676368616e6e656c4d25010012ab010a583056301006072a8648ce3d020106052b8104000a034200042b3464f5e174daad84a899552847c9af4a4577bfc9e867402aa30da9a966ab493f7c82c30642aaa5dcfbdeebe9f3ab021f09964ad93bfecb9b9e3cac7a35c9fe121663726561746f7240736d616c6c6d656469612e636f6d1a15687474703a2f2f736d616c6c6d656469612e636f6d22202a1e687474703a2f2f736d616c6c6d656469612e636f6d2f6c6f676f2e6a7067420b426967204368616e6e656c4a1e41206368616e6e656c2077697468206c6f7473206f6620766964656f732e52202a1e687474703a2f2f736d616c6c6d656469612e636f6d2f6c6f676f2e6a70675a056d757369635a0361727462050883011820620308ab016a0208206a0908e9011a044b6979766d7576a914cf1914f5cdcaf0d0ca01b53b7688dabea5cd9eb388ace221d305000000001976a9147d8fe8303a8d1506e3823e471e55ea128bfe637d88ac00000000\",\n \"inputs\": [\n {\n \"address\": \"n2FNDLjvbu4dnW6pCtGKJN87PttvCeBWsR\",\n \"amount\": \"1.9993355\",\n \"confirmations\": 1,\n \"height\": 210,\n \"is_change\": true,\n \"is_mine\": true,\n \"nout\": 1,\n \"timestamp\": 1561485089,\n \"txid\": \"0f7256329d0b2896d6f2472eea2614fbcf20ab6b22e27d168060ebb0adbaa6fa\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"mzPzDUvLyZUKv2LmQdMZAmd4ZNm1Xxgf1z\",\n \"amount\": \"1.0\",\n \"claim_id\": \"9d667ca2325a93dfbab993f4e22f63ce529eae92\",\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#9d667ca2325a93dfbab993f4e22f63ce529eae92\",\n \"timestamp\": null,\n \"txid\": \"aa003b09c9a280b34d3d790f7bca3a12a7b8f0473f476cc7bc81b3853acb8ab4\",\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\": \"3056301006072a8648ce3d020106052b8104000a034200042b3464f5e174daad84a899552847c9af4a4577bfc9e867402aa30da9a966ab493f7c82c30642aaa5dcfbdeebe9f3ab021f09964ad93bfecb9b9e3cac7a35c9fe\",\n \"public_key_id\": \"mxN41g7KAmKtMbA1b25XgVWASvYVvKEcVW\",\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\": \"mrxs9s9nJgdvS6qW2ca4yr5UY6RkWS5zk9\",\n \"amount\": \"0.9772285\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 1,\n \"timestamp\": null,\n \"txid\": \"aa003b09c9a280b34d3d790f7bca3a12a7b8f0473f476cc7bc81b3853acb8ab4\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.022107\",\n \"total_input\": \"1.9993355\",\n \"total_output\": \"1.9772285\",\n \"txid\": \"aa003b09c9a280b34d3d790f7bca3a12a7b8f0473f476cc7bc81b3853acb8ab4\"\n }\n}"
|
||||
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"channel_create\", \"params\": {\"name\": \"@bigchannel\", \"bid\": \"1.0\", \"title\": \"Big Channel\", \"description\": \"A channel with lots of videos.\", \"email\": \"creator@smallmedia.com\", \"website_url\": \"http://smallmedia.com\", \"featured\": [], \"tags\": [\"music\", \"art\"], \"languages\": [\"pt-BR\", \"uk\"], \"locations\": [\"BR\", \"UA::Kiyv\"], \"thumbnail_url\": \"http://smallmedia.com/logo.jpg\", \"cover_url\": \"http://smallmedia.com/logo.jpg\", \"preview\": false}}).json()",
|
||||
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"010000000164ddfed624b05a77a72a6f56208a73d73483cd303a81753c9cb1cba30c5f663f010000006a47304402207c048cfb78f8e2bca9395448ea87ae4d932e9f30fbeef88950490700e22867b7022055d06a29ed14fe51ac059bfb1c87e7e8dda755a8c772cd82d3dd0bb03a7c0d980121023029cb2848043d7fdbbfee2e289e7138e1fda02f479f4fc7c70f6057b4749b15ffffffff0200e1f50500000000fd5001b50b406269676368616e6e656c4d25010012ab010a583056301006072a8648ce3d020106052b8104000a03420004816277e675319fe21d8a1605d7ab8840d0d4c7972252914c58b4883d22501c5185c450737232112d3c1d011d258ea7dbcb8430461d1bd24c28bd92b1882eca41121663726561746f7240736d616c6c6d656469612e636f6d1a15687474703a2f2f736d616c6c6d656469612e636f6d22202a1e687474703a2f2f736d616c6c6d656469612e636f6d2f6c6f676f2e6a7067420b426967204368616e6e656c4a1e41206368616e6e656c2077697468206c6f7473206f6620766964656f732e52202a1e687474703a2f2f736d616c6c6d656469612e636f6d2f6c6f676f2e6a70675a056d757369635a0361727462050883011820620308ab016a0208206a0908e9011a044b6979766d7576a9146edf701f9576ecc9350a237341c557039e4fe91988ace221d305000000001976a9144cfde5a37df242b0d4d9d975bc1c6d11243b511b88ac00000000\",\n \"inputs\": [\n {\n \"address\": \"mi8yHTnrdinYn2JFHXBsSK4CBex6CtaRFK\",\n \"amount\": \"1.9993355\",\n \"confirmations\": 1,\n \"height\": 210,\n \"is_change\": true,\n \"is_mine\": true,\n \"nout\": 1,\n \"timestamp\": 1559011813,\n \"txid\": \"3f665f0ca3cbb19c3c75813a30cd8334d7738a20566f2aa7775ab024d6fedd64\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"mqdCHu4sTh3bZoSTyMwR62i5w3e6U9aBCA\",\n \"amount\": \"1.0\",\n \"claim_id\": \"9c594079a7dd41fbc8d68011bec5bcdfb0f8dddb\",\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#9c594079a7dd41fbc8d68011bec5bcdfb0f8dddb\",\n \"timestamp\": null,\n \"txid\": \"60b2c4430178f48b1b4bdda0aaacd66fe1512d0c0e4f16e646a6d178a6a112c9\",\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\": \"3056301006072a8648ce3d020106052b8104000a03420004816277e675319fe21d8a1605d7ab8840d0d4c7972252914c58b4883d22501c5185c450737232112d3c1d011d258ea7dbcb8430461d1bd24c28bd92b1882eca41\",\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\": \"mnY3oi1Auwp7Cb4CQRGDLoKWwsARVzes45\",\n \"amount\": \"0.9772285\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 1,\n \"timestamp\": null,\n \"txid\": \"60b2c4430178f48b1b4bdda0aaacd66fe1512d0c0e4f16e646a6d178a6a112c9\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.022107\",\n \"total_input\": \"1.9993355\",\n \"total_output\": \"1.9772285\",\n \"txid\": \"60b2c4430178f48b1b4bdda0aaacd66fe1512d0c0e4f16e646a6d178a6a112c9\"\n }\n}"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "channel_export",
|
||||
"description": "Export channel private key.",
|
||||
"description": "Export serialized channel signing information for a given certificate claim id",
|
||||
"arguments": [
|
||||
{
|
||||
"name": "channel_id",
|
||||
"name": "claim_id",
|
||||
"type": "str",
|
||||
"description": "claim id of channel to export",
|
||||
"description": "Claim ID to export information about",
|
||||
"is_required": true
|
||||
},
|
||||
{
|
||||
"name": "channel_name",
|
||||
"type": "str",
|
||||
"description": "name of channel to export",
|
||||
"is_required": false
|
||||
},
|
||||
{
|
||||
"name": "account_id",
|
||||
"type": "str",
|
||||
"description": "one or more account ids for accounts to look in for channels, defaults to all accounts.",
|
||||
"is_required": false
|
||||
}
|
||||
],
|
||||
"returns": "(str) serialized channel private key",
|
||||
"returns": "(str) Serialized certificate information",
|
||||
"examples": []
|
||||
},
|
||||
{
|
||||
"name": "channel_import",
|
||||
"description": "Import serialized channel private key (to allow signing new streams to the channel)",
|
||||
"description": "Import serialized channel signing information (to allow signing new claims to the channel)",
|
||||
"arguments": [
|
||||
{
|
||||
"name": "channel_data",
|
||||
"name": "serialized_certificate_info",
|
||||
"type": "str",
|
||||
"description": "serialized channel, as exported by channel export",
|
||||
"description": "certificate info",
|
||||
"is_required": true
|
||||
}
|
||||
],
|
||||
@@ -1188,14 +1164,14 @@
|
||||
"curl": "curl -d'{\"method\": \"channel_list\", \"params\": {}}' http://localhost:5279/",
|
||||
"lbrynet": "lbrynet channel list",
|
||||
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"channel_list\", \"params\": {}}).json()",
|
||||
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": [\n {\n \"address\": \"n3rBuPQB9qzAha4xU1uHyP5nmvR3WGq3r6\",\n \"amount\": \"1.0\",\n \"claim_id\": \"7ed794458d57978c49572424e1d32c7fa4d5325e\",\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#7ed794458d57978c49572424e1d32c7fa4d5325e\",\n \"timestamp\": 1561485089,\n \"txid\": \"50e9f458f59f7ddb51c13e956b178ac9457e00e36bddfe02f6f48079d3e3f896\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a0342000465bebc31803d2a7f0f037f696665d4d610abea2e518f906410163dec7513fc2b9a82ae0c4a15602f467d4c03823d72cf95c36fc6a87e963356e44db502027ae2\",\n \"public_key_id\": \"mrqYtVaoPEPqgyRPExUPi7PrYJ9nDc59yW\"\n },\n \"value_type\": \"channel\"\n }\n ]\n}"
|
||||
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": [\n {\n \"address\": \"muK7TZrirA8yHzxFcXa51W7CjxbAho2Zua\",\n \"amount\": \"1.0\",\n \"claim_id\": \"682bdf7e3ea6564bcf8aebe3cf227544189d1a6d\",\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#682bdf7e3ea6564bcf8aebe3cf227544189d1a6d\",\n \"timestamp\": 1559011813,\n \"txid\": \"1e6a8336442131461b92bdf3098baa01790df5a0d7d75bd1ab703744bc2ace9a\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004eeccdcff00c8336c5d616fee009894e5cbbc2bbf9497021aabbde81beaf8e6edf423de4ff094a8d4e7ea87d9469fd7d3b834b80d9b330d2f7a887108c5ea9268\"\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\": \"n3rBuPQB9qzAha4xU1uHyP5nmvR3WGq3r6\",\n \"amount\": \"1.0\",\n \"claim_id\": \"7ed794458d57978c49572424e1d32c7fa4d5325e\",\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#7ed794458d57978c49572424e1d32c7fa4d5325e\",\n \"timestamp\": 1561485089,\n \"txid\": \"50e9f458f59f7ddb51c13e956b178ac9457e00e36bddfe02f6f48079d3e3f896\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a0342000465bebc31803d2a7f0f037f696665d4d610abea2e518f906410163dec7513fc2b9a82ae0c4a15602f467d4c03823d72cf95c36fc6a87e963356e44db502027ae2\",\n \"public_key_id\": \"mrqYtVaoPEPqgyRPExUPi7PrYJ9nDc59yW\"\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\": \"muK7TZrirA8yHzxFcXa51W7CjxbAho2Zua\",\n \"amount\": \"1.0\",\n \"claim_id\": \"682bdf7e3ea6564bcf8aebe3cf227544189d1a6d\",\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#682bdf7e3ea6564bcf8aebe3cf227544189d1a6d\",\n \"timestamp\": 1559011813,\n \"txid\": \"1e6a8336442131461b92bdf3098baa01790df5a0d7d75bd1ab703744bc2ace9a\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004eeccdcff00c8336c5d616fee009894e5cbbc2bbf9497021aabbde81beaf8e6edf423de4ff094a8d4e7ea87d9469fd7d3b834b80d9b330d2f7a887108c5ea9268\"\n },\n \"value_type\": \"channel\"\n }\n ],\n \"page\": 1,\n \"page_size\": 20,\n \"total_items\": 1,\n \"total_pages\": 1\n }\n}"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -1323,12 +1299,6 @@
|
||||
"description": "do not broadcast the transaction",
|
||||
"is_required": false
|
||||
},
|
||||
{
|
||||
"name": "blocking",
|
||||
"type": "bool",
|
||||
"description": "wait until transaction is in mempool",
|
||||
"is_required": false
|
||||
},
|
||||
{
|
||||
"name": "replace",
|
||||
"type": "bool",
|
||||
@@ -1340,10 +1310,10 @@
|
||||
"examples": [
|
||||
{
|
||||
"title": "Update a channel claim",
|
||||
"curl": "curl -d'{\"method\": \"channel_update\", \"params\": {\"claim_id\": \"7ed794458d57978c49572424e1d32c7fa4d5325e\", \"title\": \"New Channel\", \"featured\": [], \"clear_featured\": false, \"tags\": [], \"clear_tags\": false, \"languages\": [], \"clear_languages\": false, \"locations\": [], \"clear_locations\": false, \"new_signing_key\": false, \"preview\": false, \"blocking\": false, \"replace\": false}}' http://localhost:5279/",
|
||||
"lbrynet": "lbrynet channel update 7ed794458d57978c49572424e1d32c7fa4d5325e --title=\"New Channel\"",
|
||||
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"channel_update\", \"params\": {\"claim_id\": \"7ed794458d57978c49572424e1d32c7fa4d5325e\", \"title\": \"New Channel\", \"featured\": [], \"clear_featured\": false, \"tags\": [], \"clear_tags\": false, \"languages\": [], \"clear_languages\": false, \"locations\": [], \"clear_locations\": false, \"new_signing_key\": false, \"preview\": false, \"blocking\": false, \"replace\": false}}).json()",
|
||||
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"010000000296f8e3d37980f4f602fedd6be3007e45c98a176b953ec151db7d9ff558f4e950000000006a473044022061d6150bc3b011aaea76878575017c4e5eb21fac6b8a4cbbee9c085bd33587d50220488279fbf29cc4cbbedf4203082a16ae48b966181fea88d5d30e3627f28811730121020cd9a5a73e65c43d276d79901f21b22d09f3872e97a9311ea27908142217f6f7ffffffff5dd1cf1adfb176787a309e839cb05d9811f2b7e1144d1deec09b7e61d186e6c5000000006a47304402205b253336e35c39d7bee5e39508281043e4b463cf1ad1f76dc244ee869ef185b502205891abd1fa4c637b43ae19dde8857e9fb09627a173e84ba6bd96dfc1d154a087012103398d533373ab8881bb7a9e1060284ce9afd4e25fcca09d30fcf41da9b809ff11ffffffff0200e1f50500000000a6b708406368616e6e656c145e32d5a47f2cd3e1242457498c97578d4594d77e4c6a00125a0a583056301006072a8648ce3d020106052b8104000a0342000465bebc31803d2a7f0f037f696665d4d610abea2e518f906410163dec7513fc2b9a82ae0c4a15602f467d4c03823d72cf95c36fc6a87e963356e44db502027ae2420b4e6577204368616e6e656c6d6d76a914f4f607e8d47646250a79cfc9e57059e6ca8bb56688ac6ebeea0b000000001976a914e367f3d29e8b54f79c92ec2cf83a79ca5e04c60688ac00000000\",\n \"inputs\": [\n {\n \"address\": \"n3rBuPQB9qzAha4xU1uHyP5nmvR3WGq3r6\",\n \"amount\": \"1.0\",\n \"claim_id\": \"7ed794458d57978c49572424e1d32c7fa4d5325e\",\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#7ed794458d57978c49572424e1d32c7fa4d5325e\",\n \"timestamp\": 1561485089,\n \"txid\": \"50e9f458f59f7ddb51c13e956b178ac9457e00e36bddfe02f6f48079d3e3f896\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a0342000465bebc31803d2a7f0f037f696665d4d610abea2e518f906410163dec7513fc2b9a82ae0c4a15602f467d4c03823d72cf95c36fc6a87e963356e44db502027ae2\",\n \"public_key_id\": \"mrqYtVaoPEPqgyRPExUPi7PrYJ9nDc59yW\"\n },\n \"value_type\": \"channel\"\n },\n {\n \"address\": \"mzbuijFAnVGiEKWb9n24hcrUgdxauR3i83\",\n \"amount\": \"1.999604\",\n \"confirmations\": 1,\n \"height\": 209,\n \"is_change\": true,\n \"is_mine\": true,\n \"nout\": 0,\n \"timestamp\": 1561485089,\n \"txid\": \"c5e686d1617e9bc0ee1d4d14e1b7f211985db09c839e307a7876b1df1acfd15d\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"n3rBuPQB9qzAha4xU1uHyP5nmvR3WGq3r6\",\n \"amount\": \"1.0\",\n \"claim_id\": \"7ed794458d57978c49572424e1d32c7fa4d5325e\",\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#7ed794458d57978c49572424e1d32c7fa4d5325e\",\n \"timestamp\": null,\n \"txid\": \"0f7256329d0b2896d6f2472eea2614fbcf20ab6b22e27d168060ebb0adbaa6fa\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a0342000465bebc31803d2a7f0f037f696665d4d610abea2e518f906410163dec7513fc2b9a82ae0c4a15602f467d4c03823d72cf95c36fc6a87e963356e44db502027ae2\",\n \"public_key_id\": \"mrqYtVaoPEPqgyRPExUPi7PrYJ9nDc59yW\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n },\n {\n \"address\": \"n2FNDLjvbu4dnW6pCtGKJN87PttvCeBWsR\",\n \"amount\": \"1.9993355\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 1,\n \"timestamp\": null,\n \"txid\": \"0f7256329d0b2896d6f2472eea2614fbcf20ab6b22e27d168060ebb0adbaa6fa\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.0002685\",\n \"total_input\": \"2.999604\",\n \"total_output\": \"2.9993355\",\n \"txid\": \"0f7256329d0b2896d6f2472eea2614fbcf20ab6b22e27d168060ebb0adbaa6fa\"\n }\n}"
|
||||
"curl": "curl -d'{\"method\": \"channel_update\", \"params\": {\"claim_id\": \"682bdf7e3ea6564bcf8aebe3cf227544189d1a6d\", \"title\": \"New Channel\", \"featured\": [], \"clear_featured\": false, \"tags\": [], \"clear_tags\": false, \"languages\": [], \"clear_languages\": false, \"locations\": [], \"clear_locations\": false, \"new_signing_key\": false, \"preview\": false, \"replace\": false}}' http://localhost:5279/",
|
||||
"lbrynet": "lbrynet channel update 682bdf7e3ea6564bcf8aebe3cf227544189d1a6d --title=\"New Channel\"",
|
||||
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"channel_update\", \"params\": {\"claim_id\": \"682bdf7e3ea6564bcf8aebe3cf227544189d1a6d\", \"title\": \"New Channel\", \"featured\": [], \"clear_featured\": false, \"tags\": [], \"clear_tags\": false, \"languages\": [], \"clear_languages\": false, \"locations\": [], \"clear_locations\": false, \"new_signing_key\": false, \"preview\": false, \"replace\": false}}).json()",
|
||||
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"01000000029ace2abc443770abd15bd7d7a0f50d7901aa8b09f3bd921b4631214436836a1e000000006b483045022100ce01d888adf2a629f71342ddb1c127ddd04cea8bcf18c67ccc94a97b2e4798ae02202150f0091d71f69cf5656cd525b789ca5ef38a5416e6995c22a53748b653f0900121022f03def56e0d77c0f19e1c8ae315abccbf761e76343f19324fc8d5e4e521716bffffffffbaaf5b2ddeda8c5a6f931bb2a33b8f7bef07e0c2c1e4241ba40779857be0da92000000006b483045022100f3fdc34c545f2116042ccff330a3af3dc195329bb64e0a4a08dd75beed959b0602205680bab6e19b244670fdb86f86197b9d6028b11a67fcdfa6b91907634c7fe291012102500d97c6528fc25ed450b3ad8e62934e5400cc601941e5a4f8b250c8a88f7a3dffffffff0200e1f50500000000a6b708406368616e6e656c146d1a9d18447522cfe3eb8acf4b56a63e7edf2b684c6a00125a0a583056301006072a8648ce3d020106052b8104000a03420004eeccdcff00c8336c5d616fee009894e5cbbc2bbf9497021aabbde81beaf8e6edf423de4ff094a8d4e7ea87d9469fd7d3b834b80d9b330d2f7a887108c5ea9268420b4e6577204368616e6e656c6d6d76a91497546b4edcb94a6b0fcd8593ed3a942c92ca8d9988ac6ebeea0b000000001976a9141cc00d6cb1247dee818dda0fca641e7e016c98b888ac00000000\",\n \"inputs\": [\n {\n \"address\": \"muK7TZrirA8yHzxFcXa51W7CjxbAho2Zua\",\n \"amount\": \"1.0\",\n \"claim_id\": \"682bdf7e3ea6564bcf8aebe3cf227544189d1a6d\",\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#682bdf7e3ea6564bcf8aebe3cf227544189d1a6d\",\n \"timestamp\": 1559011813,\n \"txid\": \"1e6a8336442131461b92bdf3098baa01790df5a0d7d75bd1ab703744bc2ace9a\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004eeccdcff00c8336c5d616fee009894e5cbbc2bbf9497021aabbde81beaf8e6edf423de4ff094a8d4e7ea87d9469fd7d3b834b80d9b330d2f7a887108c5ea9268\"\n },\n \"value_type\": \"channel\"\n },\n {\n \"address\": \"mq1SLhoqW2g3qY1eGpcp2r5Xw1Vf19ocP8\",\n \"amount\": \"1.999604\",\n \"confirmations\": 1,\n \"height\": 209,\n \"is_change\": true,\n \"is_mine\": true,\n \"nout\": 0,\n \"timestamp\": 1559011813,\n \"txid\": \"92dae07b857907a41b24e4c1c2e007ef7b8f3ba3b21b936f5a8cdade2d5bafba\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"muK7TZrirA8yHzxFcXa51W7CjxbAho2Zua\",\n \"amount\": \"1.0\",\n \"claim_id\": \"682bdf7e3ea6564bcf8aebe3cf227544189d1a6d\",\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#682bdf7e3ea6564bcf8aebe3cf227544189d1a6d\",\n \"timestamp\": null,\n \"txid\": \"3f665f0ca3cbb19c3c75813a30cd8334d7738a20566f2aa7775ab024d6fedd64\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004eeccdcff00c8336c5d616fee009894e5cbbc2bbf9497021aabbde81beaf8e6edf423de4ff094a8d4e7ea87d9469fd7d3b834b80d9b330d2f7a887108c5ea9268\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n },\n {\n \"address\": \"mi8yHTnrdinYn2JFHXBsSK4CBex6CtaRFK\",\n \"amount\": \"1.9993355\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 1,\n \"timestamp\": null,\n \"txid\": \"3f665f0ca3cbb19c3c75813a30cd8334d7738a20566f2aa7775ab024d6fedd64\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.0002685\",\n \"total_input\": \"2.999604\",\n \"total_output\": \"2.9993355\",\n \"txid\": \"3f665f0ca3cbb19c3c75813a30cd8334d7738a20566f2aa7775ab024d6fedd64\"\n }\n}"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1382,14 +1352,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\": \"mpDcDEwvfvETWqTDhddKLTzZZS2GBQWBqC\",\n \"amount\": \"1.0\",\n \"claim_id\": \"5d64500fb723eded83a41b0d5055f1783f019191\",\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#5d64500fb723eded83a41b0d5055f1783f019191\",\n \"signing_channel\": {\n \"address\": \"n3rBuPQB9qzAha4xU1uHyP5nmvR3WGq3r6\",\n \"amount\": \"1.0\",\n \"claim_id\": \"7ed794458d57978c49572424e1d32c7fa4d5325e\",\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#7ed794458d57978c49572424e1d32c7fa4d5325e\",\n \"timestamp\": 1561485089,\n \"txid\": \"0f7256329d0b2896d6f2472eea2614fbcf20ab6b22e27d168060ebb0adbaa6fa\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a0342000465bebc31803d2a7f0f037f696665d4d610abea2e518f906410163dec7513fc2b9a82ae0c4a15602f467d4c03823d72cf95c36fc6a87e963356e44db502027ae2\",\n \"public_key_id\": \"mrqYtVaoPEPqgyRPExUPi7PrYJ9nDc59yW\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n },\n \"timestamp\": 1561485090,\n \"txid\": \"dac2f1adaf5debd8cb377673b35ee4e6eb62ba7747b4440ffdb44d6875c2197e\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpzj1qbxfj\",\n \"sd_hash\": \"d85e47456630442a413f6cbedbdc4b0a5177770155d8a4523bbf2f301ebae95e0785cb475ca8d1a9d3cab54a05de64d3\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"value_type\": \"stream\"\n },\n {\n \"address\": \"n3rBuPQB9qzAha4xU1uHyP5nmvR3WGq3r6\",\n \"amount\": \"1.0\",\n \"claim_id\": \"7ed794458d57978c49572424e1d32c7fa4d5325e\",\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#7ed794458d57978c49572424e1d32c7fa4d5325e\",\n \"timestamp\": 1561485089,\n \"txid\": \"0f7256329d0b2896d6f2472eea2614fbcf20ab6b22e27d168060ebb0adbaa6fa\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a0342000465bebc31803d2a7f0f037f696665d4d610abea2e518f906410163dec7513fc2b9a82ae0c4a15602f467d4c03823d72cf95c36fc6a87e963356e44db502027ae2\",\n \"public_key_id\": \"mrqYtVaoPEPqgyRPExUPi7PrYJ9nDc59yW\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n }\n ]\n}"
|
||||
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": [\n {\n \"address\": \"mg5Gn2NmJFVpZUU1ScVKf34KXVmJsrxXeu\",\n \"amount\": \"1.0\",\n \"claim_id\": \"ffdbe8f44f285fbc4a352763727abd86d17399c1\",\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#ffdbe8f44f285fbc4a352763727abd86d17399c1\",\n \"signing_channel\": {\n \"address\": \"muK7TZrirA8yHzxFcXa51W7CjxbAho2Zua\",\n \"amount\": \"1.0\",\n \"claim_id\": \"682bdf7e3ea6564bcf8aebe3cf227544189d1a6d\",\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#682bdf7e3ea6564bcf8aebe3cf227544189d1a6d\",\n \"timestamp\": 1559011813,\n \"txid\": \"3f665f0ca3cbb19c3c75813a30cd8334d7738a20566f2aa7775ab024d6fedd64\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004eeccdcff00c8336c5d616fee009894e5cbbc2bbf9497021aabbde81beaf8e6edf423de4ff094a8d4e7ea87d9469fd7d3b834b80d9b330d2f7a887108c5ea9268\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n },\n \"timestamp\": 1559011814,\n \"txid\": \"fa78db71b5e4205ec33a69106f9c9528ed9289fa3f8efc51baebe6e514247287\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmp6h32p99s\",\n \"sd_hash\": \"e38f25767c7619948832380b12def270aa244ee0b712020551198b2c587babb08583b7ad928ea08f71e1a6ced74836e0\",\n \"size\": \"11\"\n }\n },\n \"value_type\": \"stream\"\n },\n {\n \"address\": \"muK7TZrirA8yHzxFcXa51W7CjxbAho2Zua\",\n \"amount\": \"1.0\",\n \"claim_id\": \"682bdf7e3ea6564bcf8aebe3cf227544189d1a6d\",\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#682bdf7e3ea6564bcf8aebe3cf227544189d1a6d\",\n \"timestamp\": 1559011813,\n \"txid\": \"3f665f0ca3cbb19c3c75813a30cd8334d7738a20566f2aa7775ab024d6fedd64\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004eeccdcff00c8336c5d616fee009894e5cbbc2bbf9497021aabbde81beaf8e6edf423de4ff094a8d4e7ea87d9469fd7d3b834b80d9b330d2f7a887108c5ea9268\",\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\": \"mpDcDEwvfvETWqTDhddKLTzZZS2GBQWBqC\",\n \"amount\": \"1.0\",\n \"claim_id\": \"5d64500fb723eded83a41b0d5055f1783f019191\",\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#5d64500fb723eded83a41b0d5055f1783f019191\",\n \"signing_channel\": {\n \"address\": \"n3rBuPQB9qzAha4xU1uHyP5nmvR3WGq3r6\",\n \"amount\": \"1.0\",\n \"claim_id\": \"7ed794458d57978c49572424e1d32c7fa4d5325e\",\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#7ed794458d57978c49572424e1d32c7fa4d5325e\",\n \"timestamp\": 1561485089,\n \"txid\": \"0f7256329d0b2896d6f2472eea2614fbcf20ab6b22e27d168060ebb0adbaa6fa\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a0342000465bebc31803d2a7f0f037f696665d4d610abea2e518f906410163dec7513fc2b9a82ae0c4a15602f467d4c03823d72cf95c36fc6a87e963356e44db502027ae2\",\n \"public_key_id\": \"mrqYtVaoPEPqgyRPExUPi7PrYJ9nDc59yW\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n },\n \"timestamp\": 1561485090,\n \"txid\": \"dac2f1adaf5debd8cb377673b35ee4e6eb62ba7747b4440ffdb44d6875c2197e\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpzj1qbxfj\",\n \"sd_hash\": \"d85e47456630442a413f6cbedbdc4b0a5177770155d8a4523bbf2f301ebae95e0785cb475ca8d1a9d3cab54a05de64d3\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"value_type\": \"stream\"\n },\n {\n \"address\": \"n3rBuPQB9qzAha4xU1uHyP5nmvR3WGq3r6\",\n \"amount\": \"1.0\",\n \"claim_id\": \"7ed794458d57978c49572424e1d32c7fa4d5325e\",\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#7ed794458d57978c49572424e1d32c7fa4d5325e\",\n \"timestamp\": 1561485089,\n \"txid\": \"0f7256329d0b2896d6f2472eea2614fbcf20ab6b22e27d168060ebb0adbaa6fa\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a0342000465bebc31803d2a7f0f037f696665d4d610abea2e518f906410163dec7513fc2b9a82ae0c4a15602f467d4c03823d72cf95c36fc6a87e963356e44db502027ae2\",\n \"public_key_id\": \"mrqYtVaoPEPqgyRPExUPi7PrYJ9nDc59yW\",\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\": \"mg5Gn2NmJFVpZUU1ScVKf34KXVmJsrxXeu\",\n \"amount\": \"1.0\",\n \"claim_id\": \"ffdbe8f44f285fbc4a352763727abd86d17399c1\",\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#ffdbe8f44f285fbc4a352763727abd86d17399c1\",\n \"signing_channel\": {\n \"address\": \"muK7TZrirA8yHzxFcXa51W7CjxbAho2Zua\",\n \"amount\": \"1.0\",\n \"claim_id\": \"682bdf7e3ea6564bcf8aebe3cf227544189d1a6d\",\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#682bdf7e3ea6564bcf8aebe3cf227544189d1a6d\",\n \"timestamp\": 1559011813,\n \"txid\": \"3f665f0ca3cbb19c3c75813a30cd8334d7738a20566f2aa7775ab024d6fedd64\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004eeccdcff00c8336c5d616fee009894e5cbbc2bbf9497021aabbde81beaf8e6edf423de4ff094a8d4e7ea87d9469fd7d3b834b80d9b330d2f7a887108c5ea9268\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n },\n \"timestamp\": 1559011814,\n \"txid\": \"fa78db71b5e4205ec33a69106f9c9528ed9289fa3f8efc51baebe6e514247287\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmp6h32p99s\",\n \"sd_hash\": \"e38f25767c7619948832380b12def270aa244ee0b712020551198b2c587babb08583b7ad928ea08f71e1a6ced74836e0\",\n \"size\": \"11\"\n }\n },\n \"value_type\": \"stream\"\n },\n {\n \"address\": \"muK7TZrirA8yHzxFcXa51W7CjxbAho2Zua\",\n \"amount\": \"1.0\",\n \"claim_id\": \"682bdf7e3ea6564bcf8aebe3cf227544189d1a6d\",\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#682bdf7e3ea6564bcf8aebe3cf227544189d1a6d\",\n \"timestamp\": 1559011813,\n \"txid\": \"3f665f0ca3cbb19c3c75813a30cd8334d7738a20566f2aa7775ab024d6fedd64\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004eeccdcff00c8336c5d616fee009894e5cbbc2bbf9497021aabbde81beaf8e6edf423de4ff094a8d4e7ea87d9469fd7d3b834b80d9b330d2f7a887108c5ea9268\",\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}"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -1424,49 +1394,25 @@
|
||||
{
|
||||
"name": "channel",
|
||||
"type": "str",
|
||||
"description": "claims signed by this channel (argument is a URL which automatically gets resolved), see --channel_ids if you need to filter by multiple channels at the same time, includes claims with invalid signatures, use in conjunction with --valid_channel_signature",
|
||||
"description": "claims signed by this channel (argument is a URL which automatically gets resolved), see --channel_ids if you need to filter by multiple channels at the same time, includes claims with invalid signatures, use in conjunction with --is_channel_signature_valid",
|
||||
"is_required": false
|
||||
},
|
||||
{
|
||||
"name": "channel_ids",
|
||||
"type": "str",
|
||||
"description": "claims signed by any of these channels (arguments must be claim ids of the channels), includes claims with invalid signatures, implies --has_channel_signature, use in conjunction with --valid_channel_signature",
|
||||
"description": "claims signed by any of these channels (arguments must be claim ids of the channels), includes claims with invalid signatures, use in conjunction with --is_channel_signature_valid",
|
||||
"is_required": false
|
||||
},
|
||||
{
|
||||
"name": "not_channel_ids",
|
||||
"type": "str",
|
||||
"description": "exclude claims signed by any of these channels (arguments must be claim ids of the channels)",
|
||||
"is_required": false
|
||||
},
|
||||
{
|
||||
"name": "has_channel_signature",
|
||||
"name": "is_channel_signature_valid",
|
||||
"type": "bool",
|
||||
"description": "claims with a channel signature (valid or invalid)",
|
||||
"is_required": false
|
||||
},
|
||||
{
|
||||
"name": "valid_channel_signature",
|
||||
"type": "bool",
|
||||
"description": "claims with a valid channel signature or no signature, use in conjunction with --has_channel_signature to only get claims with valid signatures",
|
||||
"is_required": false
|
||||
},
|
||||
{
|
||||
"name": "invalid_channel_signature",
|
||||
"type": "bool",
|
||||
"description": "claims with invalid channel signature or no signature, use in conjunction with --has_channel_signature to only get claims with invalid signatures",
|
||||
"description": "only return claims with valid channel signatures",
|
||||
"is_required": false
|
||||
},
|
||||
{
|
||||
"name": "is_controlling",
|
||||
"type": "bool",
|
||||
"description": "winning claims of their respective name",
|
||||
"is_required": false
|
||||
},
|
||||
{
|
||||
"name": "public_key_id",
|
||||
"type": "str",
|
||||
"description": "only return channels having this public key id, this is the same key as used in the wallet file to map channel certificate private keys: {'public_key_id': 'private key'}",
|
||||
"description": "only return winning claims of their respective name",
|
||||
"is_required": false
|
||||
},
|
||||
{
|
||||
@@ -1553,36 +1499,6 @@
|
||||
"description": "trending value calculated relative to all trending content globally (supports equality constraints)",
|
||||
"is_required": false
|
||||
},
|
||||
{
|
||||
"name": "claim_type",
|
||||
"type": "str",
|
||||
"description": "filter by 'channel', 'stream' or 'unknown'",
|
||||
"is_required": false
|
||||
},
|
||||
{
|
||||
"name": "stream_types",
|
||||
"type": "list",
|
||||
"description": "filter by 'video', 'image', 'document', etc",
|
||||
"is_required": false
|
||||
},
|
||||
{
|
||||
"name": "media_types",
|
||||
"type": "list",
|
||||
"description": "filter by 'video/mp4', 'image/png', etc",
|
||||
"is_required": false
|
||||
},
|
||||
{
|
||||
"name": "fee_currency",
|
||||
"type": "string",
|
||||
"description": "specify fee currency: LBC, BTC, USD",
|
||||
"is_required": false
|
||||
},
|
||||
{
|
||||
"name": "fee_amount",
|
||||
"type": "decimal",
|
||||
"description": "content download fee (supports equality constraints)",
|
||||
"is_required": false
|
||||
},
|
||||
{
|
||||
"name": "any_tags",
|
||||
"type": "list",
|
||||
@@ -1660,17 +1576,17 @@
|
||||
"examples": [
|
||||
{
|
||||
"title": "Search for all claims in channel",
|
||||
"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/",
|
||||
"curl": "curl -d'{\"method\": \"claim_search\", \"params\": {\"channel\": \"@channel\", \"channel_ids\": [], \"is_channel_signature_valid\": false, \"is_controlling\": false, \"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\": \"mpDcDEwvfvETWqTDhddKLTzZZS2GBQWBqC\",\n \"amount\": \"1.0\",\n \"canonical_url\": \"lbry://@channel#7/astream#5\",\n \"claim_id\": \"5d64500fb723eded83a41b0d5055f1783f019191\",\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\": 1561485090,\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#5d64500fb723eded83a41b0d5055f1783f019191\",\n \"short_url\": \"lbry://astream#5\",\n \"signing_channel\": {\n \"address\": \"n3rBuPQB9qzAha4xU1uHyP5nmvR3WGq3r6\",\n \"amount\": \"1.0\",\n \"canonical_url\": \"lbry://@channel#7\",\n \"claim_id\": \"7ed794458d57978c49572424e1d32c7fa4d5325e\",\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\": 1561485089,\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#7ed794458d57978c49572424e1d32c7fa4d5325e\",\n \"short_url\": \"lbry://@channel#7\",\n \"timestamp\": 1561485089,\n \"txid\": \"0f7256329d0b2896d6f2472eea2614fbcf20ab6b22e27d168060ebb0adbaa6fa\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a0342000465bebc31803d2a7f0f037f696665d4d610abea2e518f906410163dec7513fc2b9a82ae0c4a15602f467d4c03823d72cf95c36fc6a87e963356e44db502027ae2\",\n \"public_key_id\": \"mrqYtVaoPEPqgyRPExUPi7PrYJ9nDc59yW\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n },\n \"timestamp\": 1561485090,\n \"txid\": \"dac2f1adaf5debd8cb377673b35ee4e6eb62ba7747b4440ffdb44d6875c2197e\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpzj1qbxfj\",\n \"sd_hash\": \"d85e47456630442a413f6cbedbdc4b0a5177770155d8a4523bbf2f301ebae95e0785cb475ca8d1a9d3cab54a05de64d3\",\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}"
|
||||
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"claim_search\", \"params\": {\"channel\": \"@channel\", \"channel_ids\": [], \"is_channel_signature_valid\": false, \"is_controlling\": false, \"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 \"page\": 1,\n \"page_size\": 10,\n \"total_items\": 0,\n \"total_pages\": 0\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/",
|
||||
"curl": "curl -d'{\"method\": \"claim_search\", \"params\": {\"name\": \"astream\", \"channel_ids\": [], \"is_channel_signature_valid\": false, \"is_controlling\": false, \"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\": \"mpDcDEwvfvETWqTDhddKLTzZZS2GBQWBqC\",\n \"amount\": \"1.0\",\n \"canonical_url\": \"lbry://@channel#7/astream#5\",\n \"claim_id\": \"5d64500fb723eded83a41b0d5055f1783f019191\",\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\": 1561485090,\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#5d64500fb723eded83a41b0d5055f1783f019191\",\n \"short_url\": \"lbry://astream#5\",\n \"signing_channel\": {\n \"address\": \"n3rBuPQB9qzAha4xU1uHyP5nmvR3WGq3r6\",\n \"amount\": \"1.0\",\n \"canonical_url\": \"lbry://@channel#7\",\n \"claim_id\": \"7ed794458d57978c49572424e1d32c7fa4d5325e\",\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\": 1561485089,\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#7ed794458d57978c49572424e1d32c7fa4d5325e\",\n \"short_url\": \"lbry://@channel#7\",\n \"timestamp\": 1561485089,\n \"txid\": \"0f7256329d0b2896d6f2472eea2614fbcf20ab6b22e27d168060ebb0adbaa6fa\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a0342000465bebc31803d2a7f0f037f696665d4d610abea2e518f906410163dec7513fc2b9a82ae0c4a15602f467d4c03823d72cf95c36fc6a87e963356e44db502027ae2\",\n \"public_key_id\": \"mrqYtVaoPEPqgyRPExUPi7PrYJ9nDc59yW\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n },\n \"timestamp\": 1561485090,\n \"txid\": \"dac2f1adaf5debd8cb377673b35ee4e6eb62ba7747b4440ffdb44d6875c2197e\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpzj1qbxfj\",\n \"sd_hash\": \"d85e47456630442a413f6cbedbdc4b0a5177770155d8a4523bbf2f301ebae95e0785cb475ca8d1a9d3cab54a05de64d3\",\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}"
|
||||
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"claim_search\", \"params\": {\"name\": \"astream\", \"channel_ids\": [], \"is_channel_signature_valid\": false, \"is_controlling\": false, \"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 \"page\": 1,\n \"page_size\": 10,\n \"total_items\": 0,\n \"total_pages\": 0\n }\n}"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1684,43 +1600,13 @@
|
||||
"description": "Create and associate a comment with a claim using your channel identity.",
|
||||
"arguments": [
|
||||
{
|
||||
"name": "comment",
|
||||
"type": "str",
|
||||
"description": "Comment to be made, should be at most 2000 characters.",
|
||||
"is_required": true
|
||||
},
|
||||
{
|
||||
"name": "claim_id",
|
||||
"type": "str",
|
||||
"description": "The ID of the claim to comment on",
|
||||
"is_required": true
|
||||
},
|
||||
{
|
||||
"name": "parent_id",
|
||||
"type": "str",
|
||||
"name": "parent_comment_id",
|
||||
"type": "int",
|
||||
"description": "The ID of a comment to make a response to",
|
||||
"is_required": false
|
||||
},
|
||||
{
|
||||
"name": "channel_id",
|
||||
"type": "str",
|
||||
"description": "The ID of the channel you want to post under",
|
||||
"is_required": false
|
||||
},
|
||||
{
|
||||
"name": "channel_name",
|
||||
"type": "str",
|
||||
"description": "The channel you want to post as, prepend with a '@'",
|
||||
"is_required": false
|
||||
},
|
||||
{
|
||||
"name": "channel_account_id",
|
||||
"type": "str",
|
||||
"description": "one or more account ids for accounts to look in for channel certificates, defaults to all accounts.",
|
||||
"is_required": false
|
||||
}
|
||||
],
|
||||
"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 }",
|
||||
"returns": "(dict) Comment object if successfully made",
|
||||
"examples": []
|
||||
},
|
||||
{
|
||||
@@ -1728,43 +1614,37 @@
|
||||
"description": "List comments associated with a claim.",
|
||||
"arguments": [
|
||||
{
|
||||
"name": "claim_id",
|
||||
"type": "str",
|
||||
"description": "The claim on which the comment will be made on",
|
||||
"is_required": true
|
||||
"name": "flat",
|
||||
"type": "bool",
|
||||
"description": "Flag to indicate whether or not you want the replies to be flattened along with the rest of the comments attached to the claim. Off by default",
|
||||
"is_required": false
|
||||
},
|
||||
{
|
||||
"name": "parent_id",
|
||||
"type": "str",
|
||||
"description": "CommentId of a specific thread you'd like to see",
|
||||
"name": "parent_comment_id",
|
||||
"type": "int",
|
||||
"description": "The ID of an existing comment to list replies from",
|
||||
"is_required": false
|
||||
},
|
||||
{
|
||||
"name": "max_replies_shown",
|
||||
"type": "int",
|
||||
"description": "For every comment that we pull replies from, only retrieve up to this amount. Note: This is not the same as page size.",
|
||||
"is_required": false
|
||||
},
|
||||
{
|
||||
"name": "page",
|
||||
"type": "int",
|
||||
"description": "The page you'd like to see in the comment list.",
|
||||
"description": "The page you'd like to see in the comment list. The first page is 1, second page is 2, and so on.",
|
||||
"is_required": false
|
||||
},
|
||||
{
|
||||
"name": "page_size",
|
||||
"type": "int",
|
||||
"description": "The amount of comments that you'd like to retrieve",
|
||||
"is_required": false
|
||||
},
|
||||
{
|
||||
"name": "include_replies",
|
||||
"type": "bool",
|
||||
"description": "Whether or not you want to include replies in list",
|
||||
"is_required": false
|
||||
},
|
||||
{
|
||||
"name": "is_channel_signature_valid",
|
||||
"type": "bool",
|
||||
"description": "Only include comments with valid signatures. [Warning: Paginated total size will not change, even if list reduces]",
|
||||
"description": "The amount of comments that you'd like to retrieve in one request",
|
||||
"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 }",
|
||||
"returns": "(dict) Dict containing the following schema:\n {\n \"page\": (int) The page of comments as provided when limiting response to page_size.\n \"page_size\": (int) Number of comments in the given page. -1 if page_size wasn't used\n \"comments\": (list) Contains all the comments (as dicts) as provided by the specified parameters\n }",
|
||||
"examples": []
|
||||
}
|
||||
]
|
||||
@@ -1853,9 +1733,9 @@
|
||||
"examples": [
|
||||
{
|
||||
"title": "Delete a file",
|
||||
"curl": "curl -d'{\"method\": \"file_delete\", \"params\": {\"delete_from_download_dir\": false, \"delete_all\": false, \"claim_id\": \"5d64500fb723eded83a41b0d5055f1783f019191\"}}' http://localhost:5279/",
|
||||
"lbrynet": "lbrynet file delete --claim_id=\"5d64500fb723eded83a41b0d5055f1783f019191\"",
|
||||
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"file_delete\", \"params\": {\"delete_from_download_dir\": false, \"delete_all\": false, \"claim_id\": \"5d64500fb723eded83a41b0d5055f1783f019191\"}}).json()",
|
||||
"curl": "curl -d'{\"method\": \"file_delete\", \"params\": {\"delete_from_download_dir\": false, \"delete_all\": false, \"claim_id\": \"ffdbe8f44f285fbc4a352763727abd86d17399c1\"}}' http://localhost:5279/",
|
||||
"lbrynet": "lbrynet file delete --claim_id=\"ffdbe8f44f285fbc4a352763727abd86d17399c1\"",
|
||||
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"file_delete\", \"params\": {\"delete_from_download_dir\": false, \"delete_all\": false, \"claim_id\": \"ffdbe8f44f285fbc4a352763727abd86d17399c1\"}}).json()",
|
||||
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": true\n}"
|
||||
}
|
||||
]
|
||||
@@ -1962,14 +1842,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\": \"7ed794458d57978c49572424e1d32c7fa4d5325e\",\n \"channel_name\": \"@channel\",\n \"claim_id\": \"5d64500fb723eded83a41b0d5055f1783f019191\",\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\": \"e8b365259d5b8644a6a1eb5d2f77459f\",\n \"metadata\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpzj1qbxfj\",\n \"sd_hash\": \"d85e47456630442a413f6cbedbdc4b0a5177770155d8a4523bbf2f301ebae95e0785cb475ca8d1a9d3cab54a05de64d3\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"mime_type\": \"application/octet-stream\",\n \"nout\": 0,\n \"outpoint\": \"dac2f1adaf5debd8cb377673b35ee4e6eb62ba7747b4440ffdb44d6875c2197e:0\",\n \"points_paid\": 0.0,\n \"protobuf\": \"015e32d5a47f2cd3e1242457498c97578d4594d77ee519fc56b21384e97c75d5c1b6450f2138e209f7bbd2adb588609ba36d1982a2187070c391a89793a0b569f09fef656fe041eab1809e3964f6346ae0fb3d20f30a90010a8d010a30fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd120b746d707a6a31716278666a180b22186170706c69636174696f6e2f6f637465742d73747265616d3230d85e47456630442a413f6cbedbdc4b0a5177770155d8a4523bbf2f301ebae95e0785cb475ca8d1a9d3cab54a05de64d3\",\n \"sd_hash\": \"d85e47456630442a413f6cbedbdc4b0a5177770155d8a4523bbf2f301ebae95e0785cb475ca8d1a9d3cab54a05de64d3\",\n \"status\": \"finished\",\n \"stopped\": true,\n \"stream_hash\": \"8b7dee36b0985027ad1476590ee5759359b57e4cb6507d5288ffe1508c32177f5a39ef20772cf90da72987f6f55ce1ba\",\n \"stream_name\": \"tmpzj1qbxfj\",\n \"streaming_url\": \"http://localhost:5280/stream/d85e47456630442a413f6cbedbdc4b0a5177770155d8a4523bbf2f301ebae95e0785cb475ca8d1a9d3cab54a05de64d3\",\n \"suggested_file_name\": \"tmpzj1qbxfj\",\n \"timestamp\": null,\n \"total_bytes\": 16,\n \"total_bytes_lower_bound\": 0,\n \"txid\": \"dac2f1adaf5debd8cb377673b35ee4e6eb62ba7747b4440ffdb44d6875c2197e\",\n \"written_bytes\": null\n },\n {\n \"blobs_completed\": 1,\n \"blobs_in_stream\": 1,\n \"blobs_remaining\": 0,\n \"channel_claim_id\": \"7ed794458d57978c49572424e1d32c7fa4d5325e\",\n \"channel_name\": \"@channel\",\n \"claim_id\": \"8cef1fdff80ef393ddb24a73ba60196610bedbc9\",\n \"claim_name\": \"blank-image\",\n \"completed\": true,\n \"confirmations\": -1,\n \"content_fee\": null,\n \"download_directory\": null,\n \"download_path\": null,\n \"file_name\": null,\n \"height\": -1,\n \"key\": \"e7256de8c71f32d15b11d820dded4ae8\",\n \"metadata\": {\n \"author\": \"Picaso\",\n \"description\": \"A blank PNG that is 5x7.\",\n \"fee\": {\n \"address\": \"miLhR5kJLGVqi5Ss2VKT2Nxt4fToriqtX2\",\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\": \"1561485066\",\n \"source\": {\n \"hash\": \"6c7df435d412c603390f593ef658c199817c7830ba3f16b7eadd8f99fa50e85dbd0d2b3dc61eadc33fe096e3872d1545\",\n \"media_type\": \"image/png\",\n \"name\": \"tmp_zkvgv47.png\",\n \"sd_hash\": \"d4595a73a829c2a567a25ee1fa7ced42ae4d2d5fccc19126f01b8518537a386b6d20d611b35278afe6a5e193a762cd8c\",\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\": \"62a6d649879ce6a35a33265b8a9421faf24fd1e40457fdcdb4753d7eb7de6e0f:0\",\n \"points_paid\": 0.0,\n \"protobuf\": \"015e32d5a47f2cd3e1242457498c97578d4594d77ef0d8c8998fb8a90c600f66f6bce1b38b4f8ccca60f1896a1d0b85e3735c50d5b4841a37bb45dfdbef1ca2712189280efd4382ac843e11e6272e0389c1b99b6630ae6010a82010a306c7df435d412c603390f593ef658c199817c7830ba3f16b7eadd8f99fa50eLine 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\": \"682bdf7e3ea6564bcf8aebe3cf227544189d1a6d\",\n \"channel_name\": \"@channel\",\n \"claim_id\": \"ffdbe8f44f285fbc4a352763727abd86d17399c1\",\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\": \"1441a34034b2dbc19094f1c7b164680c\",\n \"metadata\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmp6h32p99s\",\n \"sd_hash\": \"e38f25767c7619948832380b12def270aa244ee0b712020551198b2c587babb08583b7ad928ea08f71e1a6ced74836e0\",\n \"size\": \"11\"\n }\n },\n \"mime_type\": \"application/octet-stream\",\n \"nout\": 0,\n \"outpoint\": \"fa78db71b5e4205ec33a69106f9c9528ed9289fa3f8efc51baebe6e514247287:0\",\n \"points_paid\": 0.0,\n \"protobuf\": \"016d1a9d18447522cfe3eb8acf4b56a63e7edf2b68fdfdb7869eb7447ab2e61a2d5cdf8199867bda63dd1edc699b7dee31d618198502a11309baff2f6d52104f494ca48ff9e5961c5a00badba23fcfeb010f595fc10a90010a8d010a30fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd120b746d703668333270393973180b22186170706c69636174696f6e2f6f637465742d73747265616d3230e38f25767c7619948832380b12def270aa244ee0b712020551198b2c587babb08583b7ad928ea08f71e1a6ced74836e0\",\n \"sd_hash\": \"e38f25767c7619948832380b12def270aa244ee0b712020551198b2c587babb08583b7ad928ea08f71e1a6ced74836e0\",\n \"status\": \"finished\",\n \"stopped\": true,\n \"stream_hash\": \"e5189cf47e5bdecdef6ec77874410bf7d57ac71ccfb4e6588311a7375c890e513be365538d51068fe97a0c21a8e389e0\",\n \"stream_name\": \"tmp6h32p99s\",\n \"streaming_url\": \"http://localhost:5280/stream/e38f25767c7619948832380b12def270aa244ee0b712020551198b2c587babb08583b7ad928ea08f71e1a6ced74836e0\",\n \"suggested_file_name\": \"tmp6h32p99s\",\n \"timestamp\": null,\n \"total_bytes\": 16,\n \"total_bytes_lower_bound\": 0,\n \"txid\": \"fa78db71b5e4205ec33a69106f9c9528ed9289fa3f8efc51baebe6e514247287\",\n \"written_bytes\": null\n },\n {\n \"blobs_completed\": 1,\n \"blobs_in_stream\": 1,\n \"blobs_remaining\": 0,\n \"channel_claim_id\": \"682bdf7e3ea6564bcf8aebe3cf227544189d1a6d\",\n \"channel_name\": \"@channel\",\n \"claim_id\": \"e90a079b038cabe2782bc6a5b4f55f4e5febc5a1\",\n \"claim_name\": \"blank-image\",\n \"completed\": true,\n \"confirmations\": -1,\n \"content_fee\": null,\n \"download_directory\": null,\n \"download_path\": null,\n \"file_name\": null,\n \"height\": -1,\n \"key\": \"81146b05970a6504588868483783fb9d\",\n \"metadata\": {\n \"author\": \"Picaso\",\n \"description\": \"A blank PNG that is 5x7.\",\n \"fee\": {\n \"address\": \"mhgGjVVY6kjrAxf2cz1ALfbst6CQhZ72qg\",\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\": \"1559011789\",\n \"source\": {\n \"hash\": \"6c7df435d412c603390f593ef658c199817c7830ba3f16b7eadd8f99fa50e85dbd0d2b3dc61eadc33fe096e3872d1545\",\n \"media_type\": \"image/png\",\n \"name\": \"tmpg0gz6g_3.png\",\n \"sd_hash\": \"a76d75a13ff15d946f929115e248dd411996abea4e1f37f73a72ba82fcd39a0dbbb3a3777e767984cd30e9eef2b68312\",\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\": \"5faad4dc0519a4861480b7386e58e0857801ec6d13ba2a308449546ce4d18928:0\",\n \"points_paid\": 0.0,\n \"protobuf\": \"016d1a9d18447522cfe3eb8acf4b56a63e7edf2b688f6d18586c20043e6f4852d49b4ade3732b787c4bf1335d57b0bbd87bdf4720f75eda1765146eb1bf653b82823ec8716d72920fcc8849d3ce0885ff89cb7f1ac0ae6010a82010a306c7df435d412c603390f593ef658c199817c7830ba3f16b7eadd8f99fa50e85dbd0d2b3dc61eadc33fe096e3872d1545120Line truncated
|
||||
},
|
||||
{
|
||||
"title": "List files matching a parameter",
|
||||
"curl": "curl -d'{\"method\": \"file_list\", \"params\": {\"claim_id\": \"5d64500fb723eded83a41b0d5055f1783f019191\", \"reverse\": false}}' http://localhost:5279/",
|
||||
"lbrynet": "lbrynet file list --claim_id=\"5d64500fb723eded83a41b0d5055f1783f019191\"",
|
||||
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"file_list\", \"params\": {\"claim_id\": \"5d64500fb723eded83a41b0d5055f1783f019191\", \"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\": \"7ed794458d57978c49572424e1d32c7fa4d5325e\",\n \"channel_name\": \"@channel\",\n \"claim_id\": \"5d64500fb723eded83a41b0d5055f1783f019191\",\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\": \"e8b365259d5b8644a6a1eb5d2f77459f\",\n \"metadata\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpzj1qbxfj\",\n \"sd_hash\": \"d85e47456630442a413f6cbedbdc4b0a5177770155d8a4523bbf2f301ebae95e0785cb475ca8d1a9d3cab54a05de64d3\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"mime_type\": \"application/octet-stream\",\n \"nout\": 0,\n \"outpoint\": \"dac2f1adaf5debd8cb377673b35ee4e6eb62ba7747b4440ffdb44d6875c2197e:0\",\n \"points_paid\": 0.0,\n \"protobuf\": \"015e32d5a47f2cd3e1242457498c97578d4594d77ee519fc56b21384e97c75d5c1b6450f2138e209f7bbd2adb588609ba36d1982a2187070c391a89793a0b569f09fef656fe041eab1809e3964f6346ae0fb3d20f30a90010a8d010a30fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd120b746d707a6a31716278666a180b22186170706c69636174696f6e2f6f637465742d73747265616d3230d85e47456630442a413f6cbedbdc4b0a5177770155d8a4523bbf2f301ebae95e0785cb475ca8d1a9d3cab54a05de64d3\",\n \"sd_hash\": \"d85e47456630442a413f6cbedbdc4b0a5177770155d8a4523bbf2f301ebae95e0785cb475ca8d1a9d3cab54a05de64d3\",\n \"status\": \"finished\",\n \"stopped\": true,\n \"stream_hash\": \"8b7dee36b0985027ad1476590ee5759359b57e4cb6507d5288ffe1508c32177f5a39ef20772cf90da72987f6f55ce1ba\",\n \"stream_name\": \"tmpzj1qbxfj\",\n \"streaming_url\": \"http://localhost:5280/stream/d85e47456630442a413f6cbedbdc4b0a5177770155d8a4523bbf2f301ebae95e0785cb475ca8d1a9d3cab54a05de64d3\",\n \"suggested_file_name\": \"tmpzj1qbxfj\",\n \"timestamp\": 1561485090,\n \"total_bytes\": 16,\n \"total_bytes_lower_bound\": 0,\n \"txid\": \"dac2f1adaf5debd8cb377673b35ee4e6eb62ba7747b4440ffdb44d6875c2197e\",\n \"written_bytes\": null\n }\n ]\n}"
|
||||
"curl": "curl -d'{\"method\": \"file_list\", \"params\": {\"claim_id\": \"ffdbe8f44f285fbc4a352763727abd86d17399c1\", \"reverse\": false}}' http://localhost:5279/",
|
||||
"lbrynet": "lbrynet file list --claim_id=\"ffdbe8f44f285fbc4a352763727abd86d17399c1\"",
|
||||
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"file_list\", \"params\": {\"claim_id\": \"ffdbe8f44f285fbc4a352763727abd86d17399c1\", \"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\": \"682bdf7e3ea6564bcf8aebe3cf227544189d1a6d\",\n \"channel_name\": \"@channel\",\n \"claim_id\": \"ffdbe8f44f285fbc4a352763727abd86d17399c1\",\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\": \"1441a34034b2dbc19094f1c7b164680c\",\n \"metadata\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmp6h32p99s\",\n \"sd_hash\": \"e38f25767c7619948832380b12def270aa244ee0b712020551198b2c587babb08583b7ad928ea08f71e1a6ced74836e0\",\n \"size\": \"11\"\n }\n },\n \"mime_type\": \"application/octet-stream\",\n \"nout\": 0,\n \"outpoint\": \"fa78db71b5e4205ec33a69106f9c9528ed9289fa3f8efc51baebe6e514247287:0\",\n \"points_paid\": 0.0,\n \"protobuf\": \"016d1a9d18447522cfe3eb8acf4b56a63e7edf2b68fdfdb7869eb7447ab2e61a2d5cdf8199867bda63dd1edc699b7dee31d618198502a11309baff2f6d52104f494ca48ff9e5961c5a00badba23fcfeb010f595fc10a90010a8d010a30fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd120b746d703668333270393973180b22186170706c69636174696f6e2f6f637465742d73747265616d3230e38f25767c7619948832380b12def270aa244ee0b712020551198b2c587babb08583b7ad928ea08f71e1a6ced74836e0\",\n \"sd_hash\": \"e38f25767c7619948832380b12def270aa244ee0b712020551198b2c587babb08583b7ad928ea08f71e1a6ced74836e0\",\n \"status\": \"finished\",\n \"stopped\": true,\n \"stream_hash\": \"e5189cf47e5bdecdef6ec77874410bf7d57ac71ccfb4e6588311a7375c890e513be365538d51068fe97a0c21a8e389e0\",\n \"stream_name\": \"tmp6h32p99s\",\n \"streaming_url\": \"http://localhost:5280/stream/e38f25767c7619948832380b12def270aa244ee0b712020551198b2c587babb08583b7ad928ea08f71e1a6ced74836e0\",\n \"suggested_file_name\": \"tmp6h32p99s\",\n \"timestamp\": 1559011814,\n \"total_bytes\": 16,\n \"total_bytes_lower_bound\": 0,\n \"txid\": \"fa78db71b5e4205ec33a69106f9c9528ed9289fa3f8efc51baebe6e514247287\",\n \"written_bytes\": null\n }\n ]\n}"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -2086,10 +1966,10 @@
|
||||
"examples": [
|
||||
{
|
||||
"title": "Save a file to the downloads directory",
|
||||
"curl": "curl -d'{\"method\": \"file_save\", \"params\": {\"sd_hash\": \"d85e47456630442a413f6cbedbdc4b0a5177770155d8a4523bbf2f301ebae95e0785cb475ca8d1a9d3cab54a05de64d3\"}}' http://localhost:5279/",
|
||||
"lbrynet": "lbrynet file save --sd_hash=\"d85e47456630442a413f6cbedbdc4b0a5177770155d8a4523bbf2f301ebae95e0785cb475ca8d1a9d3cab54a05de64d3\"",
|
||||
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"file_save\", \"params\": {\"sd_hash\": \"d85e47456630442a413f6cbedbdc4b0a5177770155d8a4523bbf2f301ebae95e0785cb475ca8d1a9d3cab54a05de64d3\"}}).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\": \"7ed794458d57978c49572424e1d32c7fa4d5325e\",\n \"channel_name\": \"@channel\",\n \"claim_id\": \"5d64500fb723eded83a41b0d5055f1783f019191\",\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\": \"e8b365259d5b8644a6a1eb5d2f77459f\",\n \"metadata\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpzj1qbxfj\",\n \"sd_hash\": \"d85e47456630442a413f6cbedbdc4b0a5177770155d8a4523bbf2f301ebae95e0785cb475ca8d1a9d3cab54a05de64d3\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"mime_type\": \"application/octet-stream\",\n \"nout\": 0,\n \"outpoint\": \"dac2f1adaf5debd8cb377673b35ee4e6eb62ba7747b4440ffdb44d6875c2197e:0\",\n \"points_paid\": 0.0,\n \"protobuf\": \"015e32d5a47f2cd3e1242457498c97578d4594d77ee519fc56b21384e97c75d5c1b6450f2138e209f7bbd2adb588609ba36d1982a2187070c391a89793a0b569f09fef656fe041eab1809e3964f6346ae0fb3d20f30a90010a8d010a30fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd120b746d707a6a31716278666a180b22186170706c69636174696f6e2f6f637465742d73747265616d3230d85e47456630442a413f6cbedbdc4b0a5177770155d8a4523bbf2f301ebae95e0785cb475ca8d1a9d3cab54a05de64d3\",\n \"sd_hash\": \"d85e47456630442a413f6cbedbdc4b0a5177770155d8a4523bbf2f301ebae95e0785cb475ca8d1a9d3cab54a05de64d3\",\n \"status\": \"running\",\n \"stopped\": false,\n \"stream_hash\": \"8b7dee36b0985027ad1476590ee5759359b57e4cb6507d5288ffe1508c32177f5a39ef20772cf90da72987f6f55ce1ba\",\n \"stream_name\": \"tmpzj1qbxfj\",\n \"streaming_url\": \"http://localhost:5280/stream/d85e47456630442a413f6cbedbdc4b0a5177770155d8a4523bbf2f301ebae95e0785cb475ca8d1a9d3cab54a05de64d3\",\n \"suggested_file_name\": \"tmpzj1qbxfj\",\n \"timestamp\": 1561485090,\n \"total_bytes\": 16,\n \"total_bytes_lower_bound\": 0,\n \"txid\": \"dac2f1adaf5debd8cb377673b35ee4e6eb62ba7747b4440ffdb44d6875c2197e\",\n \"written_bytes\": null\n }\n}"
|
||||
"curl": "curl -d'{\"method\": \"file_save\", \"params\": {\"sd_hash\": \"e38f25767c7619948832380b12def270aa244ee0b712020551198b2c587babb08583b7ad928ea08f71e1a6ced74836e0\"}}' http://localhost:5279/",
|
||||
"lbrynet": "lbrynet file save --sd_hash=\"e38f25767c7619948832380b12def270aa244ee0b712020551198b2c587babb08583b7ad928ea08f71e1a6ced74836e0\"",
|
||||
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"file_save\", \"params\": {\"sd_hash\": \"e38f25767c7619948832380b12def270aa244ee0b712020551198b2c587babb08583b7ad928ea08f71e1a6ced74836e0\"}}).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\": \"682bdf7e3ea6564bcf8aebe3cf227544189d1a6d\",\n \"channel_name\": \"@channel\",\n \"claim_id\": \"ffdbe8f44f285fbc4a352763727abd86d17399c1\",\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\": \"1441a34034b2dbc19094f1c7b164680c\",\n \"metadata\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmp6h32p99s\",\n \"sd_hash\": \"e38f25767c7619948832380b12def270aa244ee0b712020551198b2c587babb08583b7ad928ea08f71e1a6ced74836e0\",\n \"size\": \"11\"\n }\n },\n \"mime_type\": \"application/octet-stream\",\n \"nout\": 0,\n \"outpoint\": \"fa78db71b5e4205ec33a69106f9c9528ed9289fa3f8efc51baebe6e514247287:0\",\n \"points_paid\": 0.0,\n \"protobuf\": \"016d1a9d18447522cfe3eb8acf4b56a63e7edf2b68fdfdb7869eb7447ab2e61a2d5cdf8199867bda63dd1edc699b7dee31d618198502a11309baff2f6d52104f494ca48ff9e5961c5a00badba23fcfeb010f595fc10a90010a8d010a30fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd120b746d703668333270393973180b22186170706c69636174696f6e2f6f637465742d73747265616d3230e38f25767c7619948832380b12def270aa244ee0b712020551198b2c587babb08583b7ad928ea08f71e1a6ced74836e0\",\n \"sd_hash\": \"e38f25767c7619948832380b12def270aa244ee0b712020551198b2c587babb08583b7ad928ea08f71e1a6ced74836e0\",\n \"status\": \"running\",\n \"stopped\": false,\n \"stream_hash\": \"e5189cf47e5bdecdef6ec77874410bf7d57ac71ccfb4e6588311a7375c890e513be365538d51068fe97a0c21a8e389e0\",\n \"stream_name\": \"tmp6h32p99s\",\n \"streaming_url\": \"http://localhost:5280/stream/e38f25767c7619948832380b12def270aa244ee0b712020551198b2c587babb08583b7ad928ea08f71e1a6ced74836e0\",\n \"suggested_file_name\": \"tmp6h32p99s\",\n \"timestamp\": 1559011814,\n \"total_bytes\": 16,\n \"total_bytes_lower_bound\": 0,\n \"txid\": \"fa78db71b5e4205ec33a69106f9c9528ed9289fa3f8efc51baebe6e514247287\",\n \"written_bytes\": null\n }\n}"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -2172,14 +2052,14 @@
|
||||
"name": "settings_get",
|
||||
"description": "Get daemon settings",
|
||||
"arguments": [],
|
||||
"returns": "(dict) Dictionary of daemon settings\n See ADJUSTABLE_SETTINGS in lbry/conf.py for full list of settings",
|
||||
"returns": "(dict) Dictionary of daemon settings\n See ADJUSTABLE_SETTINGS in lbrynet/conf.py for full list of settings",
|
||||
"examples": [
|
||||
{
|
||||
"title": "Get settings",
|
||||
"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/tmpfjnst0c0\",\n \"download_dir\": \"/tmp/tmpfjnst0c0\",\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 \"udp_port\": 4444,\n \"use_upnp\": false,\n \"wallet_dir\": \"/tmp/tmpfjnst0c0\"\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 \"comment_server\": \"http://comments.lbry.com:2903/api\",\n \"components_to_skip\": [\n \"dht\",\n \"upnp\",\n \"hash_announcer\",\n \"peer_protocol_server\"\n ],\n \"concurrent_blob_announcers\": 10,\n \"concurrent_reflector_uploads\": 10,\n \"config\": \"/home/lex/.local/share/lbry/lbrynet/daemon_settings.yml\",\n \"data_dir\": \"/tmp/tmpf06o5qj4\",\n \"download_dir\": \"/tmp/tmpf06o5qj4\",\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 \"udp_port\": 4444,\n \"use_upnp\": false,\n \"wallet_dir\": \"/tmp/tmpf06o5qj4\"\n }\n}"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -2240,10 +2120,10 @@
|
||||
"examples": [
|
||||
{
|
||||
"title": "Abandon a stream claim",
|
||||
"curl": "curl -d'{\"method\": \"stream_abandon\", \"params\": {\"claim_id\": \"5d64500fb723eded83a41b0d5055f1783f019191\", \"preview\": false, \"blocking\": false}}' http://localhost:5279/",
|
||||
"lbrynet": "lbrynet stream abandon 5d64500fb723eded83a41b0d5055f1783f019191",
|
||||
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"stream_abandon\", \"params\": {\"claim_id\": \"5d64500fb723eded83a41b0d5055f1783f019191\", \"preview\": false, \"blocking\": false}}).json()",
|
||||
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"01000000017e19c275684db4fd0f44b44777ba62ebe6e45eb3737637cbd8eb5dafadf1c2da000000006b483045022100c624c1ad3ba9ef23da28e8a21bda59d223bca0cc7011e952d14ab9fc065058aa022046708292d323bf9053ded6de63ae948058fa5650c8a2a3286ca700bb797be32e0121039efda2d8dd29b422fb044b6ccf6791ec3b0489713619b3f9dd9e8c89a4e54779ffffffff0134b7f505000000001976a9145b91c67ced35c7e2197da2da28fde8c113ef8a4588ac00000000\",\n \"inputs\": [\n {\n \"address\": \"mpDcDEwvfvETWqTDhddKLTzZZS2GBQWBqC\",\n \"amount\": \"1.0\",\n \"claim_id\": \"5d64500fb723eded83a41b0d5055f1783f019191\",\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#5d64500fb723eded83a41b0d5055f1783f019191\",\n \"timestamp\": 1561485090,\n \"txid\": \"dac2f1adaf5debd8cb377673b35ee4e6eb62ba7747b4440ffdb44d6875c2197e\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpzj1qbxfj\",\n \"sd_hash\": \"d85e47456630442a413f6cbedbdc4b0a5177770155d8a4523bbf2f301ebae95e0785cb475ca8d1a9d3cab54a05de64d3\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"value_type\": \"stream\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"mos8RABG1AF9QQ4HPVABG9p9ERCQ4DGG2Z\",\n \"amount\": \"0.999893\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 0,\n \"timestamp\": null,\n \"txid\": \"43b91f8ca1e4b543ddaa540e1b9026084f137cea5e9a9d7381321508086f3ce5\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.000107\",\n \"total_input\": \"1.0\",\n \"total_output\": \"0.999893\",\n \"txid\": \"43b91f8ca1e4b543ddaa540e1b9026084f137cea5e9a9d7381321508086f3ce5\"\n }\n}"
|
||||
"curl": "curl -d'{\"method\": \"stream_abandon\", \"params\": {\"claim_id\": \"ffdbe8f44f285fbc4a352763727abd86d17399c1\", \"preview\": false, \"blocking\": false}}' http://localhost:5279/",
|
||||
"lbrynet": "lbrynet stream abandon ffdbe8f44f285fbc4a352763727abd86d17399c1",
|
||||
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"stream_abandon\", \"params\": {\"claim_id\": \"ffdbe8f44f285fbc4a352763727abd86d17399c1\", \"preview\": false, \"blocking\": false}}).json()",
|
||||
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"010000000187722414e5e6ebba51fc8e3ffa8992ed28959c6f10693ac35e20e4b571db78fa000000006b483045022100a387d3d1bbd1d7473c3d0285344b4d4fef9cfd2ec54ad3f40b2edd6852068d4802206e81afbd2b2dc48bdf2b89227aaebcf2f2f8448530125beb8cd3ac861f0ee745012102700c310dacc983a7cfe3187c0913373c956fbb5f850a13043c2897f2da825120ffffffff0134b7f505000000001976a914b70f37bc1d9a6cef8d47db72a4267c957193fe7d88ac00000000\",\n \"inputs\": [\n {\n \"address\": \"mg5Gn2NmJFVpZUU1ScVKf34KXVmJsrxXeu\",\n \"amount\": \"1.0\",\n \"claim_id\": \"ffdbe8f44f285fbc4a352763727abd86d17399c1\",\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#ffdbe8f44f285fbc4a352763727abd86d17399c1\",\n \"signing_channel\": {\n \"address\": \"muK7TZrirA8yHzxFcXa51W7CjxbAho2Zua\",\n \"amount\": \"1.0\",\n \"claim_id\": \"682bdf7e3ea6564bcf8aebe3cf227544189d1a6d\",\n \"claim_op\": \"update\",\n \"confirmations\": 7,\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#682bdf7e3ea6564bcf8aebe3cf227544189d1a6d\",\n \"timestamp\": 1559011813,\n \"txid\": \"3f665f0ca3cbb19c3c75813a30cd8334d7738a20566f2aa7775ab024d6fedd64\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004eeccdcff00c8336c5d616fee009894e5cbbc2bbf9497021aabbde81beaf8e6edf423de4ff094a8d4e7ea87d9469fd7d3b834b80d9b330d2f7a887108c5ea9268\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n },\n \"timestamp\": 1559011814,\n \"txid\": \"fa78db71b5e4205ec33a69106f9c9528ed9289fa3f8efc51baebe6e514247287\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmp6h32p99s\",\n \"sd_hash\": \"e38f25767c7619948832380b12def270aa244ee0b712020551198b2c587babb08583b7ad928ea08f71e1a6ced74836e0\",\n \"size\": \"11\"\n }\n },\n \"value_type\": \"stream\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"mxCtBWCjYjg56RoikBbn6GTFdBGBH89NdT\",\n \"amount\": \"0.999893\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 0,\n \"timestamp\": null,\n \"txid\": \"715f7493f78217a0a1f15094563adc0e09ea443b748713eea766f8d492f21815\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.000107\",\n \"total_input\": \"1.0\",\n \"total_output\": \"0.999893\",\n \"txid\": \"715f7493f78217a0a1f15094563adc0e09ea443b748713eea766f8d492f21815\"\n }\n}"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -2420,29 +2300,23 @@
|
||||
"type": "bool",
|
||||
"description": "do not broadcast the transaction",
|
||||
"is_required": false
|
||||
},
|
||||
{
|
||||
"name": "blocking",
|
||||
"type": "bool",
|
||||
"description": "wait until transaction is in mempool",
|
||||
"is_required": false
|
||||
}
|
||||
],
|
||||
"returns": " {\n \"txid\": \"hash of transaction in hex\",\n \"height\": \"block where transaction was recorded\",\n \"inputs\": [\n {\n \"txid\": \"hash of transaction in hex\",\n \"nout\": \"position in the transaction\",\n \"height\": \"block where transaction was recorded\",\n \"amount\": \"value of the txo as a decimal\",\n \"address\": \"address of who can spend the txo\",\n \"confirmations\": \"number of confirmed blocks\",\n \"is_change\": \"payment to change address, only available when it can be determined\",\n \"is_mine\": \"payment to one of your accounts, only available when it can be determined\",\n \"type\": \"one of 'claim', 'support' or 'payment'\",\n \"name\": \"when type is 'claim' or 'support', this is the claim name\",\n \"claim_id\": \"when type is 'claim' or 'support', this is the claim id\",\n \"claim_op\": \"when type is 'claim', this determines if it is 'create' or 'update'\",\n \"value\": \"when type is 'claim' or 'support' with payload, this is the decoded protobuf payload\",\n \"value_type\": \"determines the type of the 'value' field: 'channel', 'stream', etc\",\n \"protobuf\": \"hex encoded raw protobuf version of 'value' field\",\n \"permanent_url\": \"when type is 'claim' or 'support', this is the long permanent claim URL\",\n \"signing_channel\": \"for signed claims only, metadata of signing channel\",\n \"is_channel_signature_valid\": \"for signed claims only, whether signature is valid\"\n }\n ],\n \"outputs\": [\n {\n \"txid\": \"hash of transaction in hex\",\n \"nout\": \"position in the transaction\",\n \"height\": \"block where transaction was recorded\",\n \"amount\": \"value of the txo as a decimal\",\n \"address\": \"address of who can spend the txo\",\n \"confirmations\": \"number of confirmed blocks\",\n \"is_change\": \"payment to change address, only available when it can be determined\",\n \"is_mine\": \"payment to one of your accounts, only available when it can be determined\",\n \"type\": \"one of 'claim', 'support' or 'payment'\",\n \"name\": \"when type is 'claim' or 'support', this is the claim name\",\n \"claim_id\": \"when type is 'claim' or 'support', this is the claim id\",\n \"claim_op\": \"when type is 'claim', this determines if it is 'create' or 'update'\",\n \"value\": \"when type is 'claim' or 'support' with payload, this is the decoded protobuf payload\",\n \"value_type\": \"determines the type of the 'value' field: 'channel', 'stream', etc\",\n \"protobuf\": \"hex encoded raw protobuf version of 'value' field\",\n \"permanent_url\": \"when type is 'claim' or 'support', this is the long permanent claim URL\",\n \"signing_channel\": \"for signed claims only, metadata of signing channel\",\n \"is_channel_signature_valid\": \"for signed claims only, whether signature is valid\"\n }\n ],\n \"total_input\": \"sum of inputs as a decimal\",\n \"total_output\": \"sum of outputs, sans fee, as a decimal\",\n \"total_fee\": \"fee amount\",\n \"hex\": \"entire transaction encoded in hex\"\n }",
|
||||
"examples": [
|
||||
{
|
||||
"title": "Create a stream claim without metadata",
|
||||
"curl": "curl -d'{\"method\": \"stream_create\", \"params\": {\"name\": \"astream\", \"bid\": \"1.0\", \"file_path\": \"/tmp/tmpzj1qbxfj\", \"tags\": [], \"languages\": [], \"locations\": [], \"channel_account_id\": [], \"preview\": false, \"blocking\": false}}' http://localhost:5279/",
|
||||
"lbrynet": "lbrynet stream create astream 1.0 /tmp/tmpzj1qbxfj",
|
||||
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"stream_create\", \"params\": {\"name\": \"astream\", \"bid\": \"1.0\", \"file_path\": \"/tmp/tmpzj1qbxfj\", \"tags\": [], \"languages\": [], \"locations\": [], \"channel_account_id\": [], \"preview\": false, \"blocking\": false}}).json()",
|
||||
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"010000000196f8e3d37980f4f602fedd6be3007e45c98a176b953ec151db7d9ff558f4e950010000006b483045022100c86c0b5aa41515436e96d86767e75566cb5addd6c41fc03b182fd41cb50e6750022044937d16a79ed035ee77af8c4e05282b66417349a5d9bc4f340d7d5a3569f048012103fe478df2bbf4c46284220d4d439f5ced6d923cc18915e25b0fa1f14a039a758effffffff0200e1f50500000000bab5076173747265616d4c94000a90010a8d010a30fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd120b746d707a6a31716278666a180b22186170706c69636174696f6e2f6f637465742d73747265616d3230d85e47456630442a413f6cbedbdc4b0a5177770155d8a4523bbf2f301ebae95e0785cb475ca8d1a9d3cab54a05de64d36d7576a9145f714bd8d8f78a7a6836eba4625ab0d05cbf9bf188ac38fb9423000000001976a914b18165ea11e7fc078a724665b8d5f4ed879418af88ac00000000\",\n \"inputs\": [\n {\n \"address\": \"moXzxEEXj4nhGhnozbGGFqGXdEzysbDMHJ\",\n \"amount\": \"6.983769\",\n \"confirmations\": 4,\n \"height\": 209,\n \"is_change\": true,\n \"is_mine\": true,\n \"nout\": 1,\n \"timestamp\": 1561485089,\n \"txid\": \"50e9f458f59f7ddb51c13e956b178ac9457e00e36bddfe02f6f48079d3e3f896\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"mpDcDEwvfvETWqTDhddKLTzZZS2GBQWBqC\",\n \"amount\": \"1.0\",\n \"claim_id\": \"5d64500fb723eded83a41b0d5055f1783f019191\",\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#5d64500fb723eded83a41b0d5055f1783f019191\",\n \"timestamp\": null,\n \"txid\": \"c983a65d949c9badee6fdd78ec68dc214c44816576e90998a86c062790e8fffe\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpzj1qbxfj\",\n \"sd_hash\": \"d85e47456630442a413f6cbedbdc4b0a5177770155d8a4523bbf2f301ebae95e0785cb475ca8d1a9d3cab54a05de64d3\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"value_type\": \"stream\"\n },\n {\n \"address\": \"mwhWukDANoke2ikBrkj8u3kFdRh5YM2Xv7\",\n \"amount\": \"5.969662\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 1,\n \"timestamp\": null,\n \"txid\": \"c983a65d949c9badee6fdd78ec68dc214c44816576e90998a86c062790e8fffe\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.014107\",\n \"total_input\": \"6.983769\",\n \"total_output\": \"6.969662\",\n \"txid\": \"c983a65d949c9badee6fdd78ec68dc214c44816576e90998a86c062790e8fffe\"\n }\n}"
|
||||
"curl": "curl -d'{\"method\": \"stream_create\", \"params\": {\"name\": \"astream\", \"bid\": \"1.0\", \"file_path\": \"/tmp/tmp6h32p99s\", \"tags\": [], \"languages\": [], \"locations\": [], \"channel_account_id\": [], \"preview\": false}}' http://localhost:5279/",
|
||||
"lbrynet": "lbrynet stream create astream 1.0 /tmp/tmp6h32p99s",
|
||||
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"stream_create\", \"params\": {\"name\": \"astream\", \"bid\": \"1.0\", \"file_path\": \"/tmp/tmp6h32p99s\", \"tags\": [], \"languages\": [], \"locations\": [], \"channel_account_id\": [], \"preview\": false}}).json()",
|
||||
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"01000000019ace2abc443770abd15bd7d7a0f50d7901aa8b09f3bd921b4631214436836a1e010000006b483045022100bcb08cbd4591cafdbd6a45ad159d5d3a1d5b690a45afa00788044f04d8b2959b02202f746fe20222c7502bef41fe052abef118d97df7e0723e04afa13913abdec276012102500d97c6528fc25ed450b3ad8e62934e5400cc601941e5a4f8b250c8a88f7a3dffffffff0200e1f50500000000bab5076173747265616d4c94000a90010a8d010a30fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd120b746d703668333270393973180b22186170706c69636174696f6e2f6f637465742d73747265616d3230e38f25767c7619948832380b12def270aa244ee0b712020551198b2c587babb08583b7ad928ea08f71e1a6ced74836e06d7576a914061cbd2df8421ab14497e62baf747461c7c9137b88ac38fb9423000000001976a914c1c932e896b2e8073e6da13a87111deba2b5f97588ac00000000\",\n \"inputs\": [\n {\n \"address\": \"mq1SLhoqW2g3qY1eGpcp2r5Xw1Vf19ocP8\",\n \"amount\": \"6.983769\",\n \"confirmations\": 4,\n \"height\": 209,\n \"is_change\": true,\n \"is_mine\": true,\n \"nout\": 1,\n \"timestamp\": 1559011813,\n \"txid\": \"1e6a8336442131461b92bdf3098baa01790df5a0d7d75bd1ab703744bc2ace9a\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"mg5Gn2NmJFVpZUU1ScVKf34KXVmJsrxXeu\",\n \"amount\": \"1.0\",\n \"claim_id\": \"ffdbe8f44f285fbc4a352763727abd86d17399c1\",\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#ffdbe8f44f285fbc4a352763727abd86d17399c1\",\n \"timestamp\": null,\n \"txid\": \"ad2d9b984b2a9e923b12f7652dd9a945664f647e9ead8779fd9b240a68301442\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmp6h32p99s\",\n \"sd_hash\": \"e38f25767c7619948832380b12def270aa244ee0b712020551198b2c587babb08583b7ad928ea08f71e1a6ced74836e0\",\n \"size\": \"11\"\n }\n },\n \"value_type\": \"stream\"\n },\n {\n \"address\": \"myBbjcsUMBsTi5aA1Y3FQr3eXZHTkTKjGn\",\n \"amount\": \"5.969662\",\n \"confirmations\": -2,\n \"height\": -2,\n \"nout\": 1,\n \"timestamp\": null,\n \"txid\": \"ad2d9b984b2a9e923b12f7652dd9a945664f647e9ead8779fd9b240a68301442\",\n \"type\": \"payment\"\n }\n ],\n \"total_fee\": \"0.014107\",\n \"total_input\": \"6.983769\",\n \"total_output\": \"6.969662\",\n \"txid\": \"ad2d9b984b2a9e923b12f7652dd9a945664f647e9ead8779fd9b240a68301442\"\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/tmp_zkvgv47.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\": 1561485066, \"channel_id\": \"7ed794458d57978c49572424e1d32c7fa4d5325e\", \"channel_account_id\": [], \"preview\": false, \"blocking\": false}}' http://localhost:5279/",
|
||||
"lbrynet": "lbrynet stream create blank-image 1.0 /tmp/tmp_zkvgv47.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=1561485066 --channel_id=\"7ed794458d57978c49572424e1d32c7fa4d5325e\"",
|
||||
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"stream_create\", \"params\": {\"name\": \"blank-image\", \"bid\": \"1.0\", \"file_path\": \"/tmp/tmp_zkvgv47.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\": 1561485066, \"channel_id\": \"7ed794458d57978c49572424e1d32c7fa4d5325e\", \"channel_account_id\": [], \"preview\": false, \"blocking\": false}}).json()",
|
||||
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"0100000001feffe89027066ca89809e9766581444c21dc68ec78dd6feead9b9c945da683c9010000006b483045022100b3f2904121f6c6b5a41f31aae658e82db8b9b03385c5a68b4837603476905e3102206361878bb10bdf9ec3aa09e57777d67e97d93ecd6759784b937dc27441d4cb130121033c5a8006c1b3c7e3fce456220accfdf3a7b1f7f9c7a312789637d857dc8d68cbffffffff0200e1f50500000000fddc01b50b626c616e6b2d696d6167654db101015e32d5a47f2cd3e1242457498c97578d4594d77ef0d8c8998fb8a90c600f66f6bce1b38b4f8ccca60f1896a1d0b85e3735c50d5b4841a37bb45dfdbef1ca2712189280efd4382ac843e11e6272e0389c1b99b6630ae6010a82010a306c7df435d412c603390f593ef658c199817c7830ba3f16b7eadd8f99fa50e85dbd0d2b3dc61eadc33fe096e3872d1545120f746d705f7a6b76677634372e706e6718632209696d6167652f706e673230d4595a73a829c2a567a25ee1fa7ced42ae4d2d5fccc19126f01b8518537a386b6d20d611b35278afe6a5e193a762cd8c120650696361736f1a0d5075626c696320446f6d61696e2218687474703a2f2f7075626c69632d646f6d61696e2e6f7267288abec9e8053222080112196f1ef7cc2a7373816b32207342ec23f8c38dccf01292bec029188087a70e520408051007420b426c616e6b20496d6167654a184120626c616e6b20504e472074686174206973203578372e52252a23687474703a2f2f736d616c6c6d656469612e636f6d2f7468756d626e61696c2e6a70675a05626c616e6b5a03617274620208016a1308ec0112024e481a0a4d616e636865737465726d7576a9141ef7cc2a7373816b32207342ec23f8c38dccf01288acac5e7d1d000000001976a9140a576ae154110bade7e05856edb02f02c4192c2c88ac00000000\",\n \"inputs\": [\n {\n \"address\": \"mwhWukDANoke2ikBrkj8u3kFdRh5YM2Xv7\",\n \"amount\": \"5.969662\",\n \"confirmations\": 2,\n \"height\": 213,\n \"is_change\": true,\n \"is_mine\": true,\n \"nout\": 1,\n \"timestamp\": 1561485090,\n \"txid\": \"c983a65d949c9badee6fdd78ec68dc214c44816576e90998a86c062790e8fffe\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"miLhR5kJLGVqi5Ss2VKT2Nxt4fToriqtX2\",\n \"amount\": \"1.0\",\n \"claim_id\": \"8cef1fdff80ef393ddb24a73ba60196610bedbc9\",\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#8cef1fdff80ef393ddb24a73ba60196610bedbc9\",\n \"signing_channel\": {\n \"address\": \"n3rBuPQB9qzAha4xU1uHyP5nmvR3WGq3r6\",\n \"amount\": \"1.0\",\n \"claim_id\": \"7ed794458d57978c49572424e1d32c7fa4d5325e\",\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#7ed794458d57978c49572424e1d32c7fa4d5325e\",\n \"timestamp\": 1561485089,\n \"txid\": \"0f7256329d0b2896d6f2472eea2614fbcf20ab6b22e27d168060ebb0adbaa6fa\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a0342000465bebc31803d2a7f0f037f696665d4d610abea2e518f906410163dec7513fc2b9a82ae0c4a15602f467d4c03823d72cf95c36fc6a87e963356e44db502027ae2\",\n \"public_key_id\": \"mrqYtVaoPEPqgyRPExUPi7PrYJ9nDc59yW\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n },\n \"timestamp\": null,\n \"txid\": \"62a6d649879ce6a35a33265b8a9421faf24fd1e40457fdcdb4753d7eb7de6e0f\",\n \"type\": \"claim\",\n \"value\": {\n \"author\": \"Picaso\",\n \"description\": \"A blank PNG that is 5x7.\",\n \"fee\": {\n \"address\": \"miLhR5kJLGVqi5Ss2VKT2Nxt4fToriqtX2\",\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\": \"1561485066\",\n \"source\": {\n \"hash\": \"6c7df435d412c603390f593ef658c199817c7830ba3f16b7eadd8f99fa50e85dbd0d2b3dc61eadc33fe096e3872d1545\",\n \"media_type\": \"image/png\",\n \"name\": \"tmp_zkvgv47.png\",\n \"sd_hash\": \"d4595a73a829c2a567a25ee1fa7ced42ae4d2d5fccc19126f01b8518537a386b6d20d611b35278afe6a5e193a762cd8c\",\n \"size\": \"99\"\n },\n \"stream_type\": \"image\",\n \"taLine truncated
|
||||
"curl": "curl -d'{\"method\": \"stream_create\", \"params\": {\"name\": \"blank-image\", \"bid\": \"1.0\", \"file_path\": \"/tmp/tmpg0gz6g_3.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\": 1559011789, \"channel_id\": \"682bdf7e3ea6564bcf8aebe3cf227544189d1a6d\", \"channel_account_id\": [], \"preview\": false}}' http://localhost:5279/",
|
||||
"lbrynet": "lbrynet stream create blank-image 1.0 /tmp/tmpg0gz6g_3.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=1559011789 --channel_id=\"682bdf7e3ea6564bcf8aebe3cf227544189d1a6d\"",
|
||||
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"stream_create\", \"params\": {\"name\": \"blank-image\", \"bid\": \"1.0\", \"file_path\": \"/tmp/tmpg0gz6g_3.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\": 1559011789, \"channel_id\": \"682bdf7e3ea6564bcf8aebe3cf227544189d1a6d\", \"channel_account_id\": [], \"preview\": false}}).json()",
|
||||
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"0100000001421430680a249bfd7987ad9e7e644f6645a9d92d65f7123b929e2a4b989b2dad010000006b483045022100f90b38c9fd9f7b6489a17ca1af70b04b10b544c72b571b85501d465807b8bcbf02205edbc843f9a033d49a95ad1f0846c122cc5858fa3da8feba6efe91c899899225012102b7475e6b3d7641d46a7c7de4e6ba758e1730873b8d3edc388f04ee63df093ac3ffffffff0200e1f50500000000fddc01b50b626c616e6b2d696d6167654db101016d1a9d18447522cfe3eb8acf4b56a63e7edf2b688f6d18586c20043e6f4852d49b4ade3732b787c4bf1335d57b0bbd87bdf4720f75eda1765146eb1bf653b82823ec8716d72920fcc8849d3ce0885ff89cb7f1ac0ae6010a82010a306c7df435d412c603390f593ef658c199817c7830ba3f16b7eadd8f99fa50e85dbd0d2b3dc61eadc33fe096e3872d1545120f746d706730677a36675f332e706e6718632209696d6167652f706e673230a76d75a13ff15d946f929115e248dd411996abea4e1f37f73a72ba82fcd39a0dbbb3a3777e767984cd30e9eef2b68312120650696361736f1a0d5075626c696320446f6d61696e2218687474703a2f2f7075626c69632d646f6d61696e2e6f726728cdc3b2e7053222080112196f17b363112d0b4907e7bf652c16c5261696179baf4b16065b188087a70e520408051007420b426c616e6b20496d6167654a184120626c616e6b20504e472074686174206973203578372e52252a23687474703a2f2f736d616c6c6d656469612e636f6d2f7468756d626e61696c2e6a70675a05626c616e6b5a03617274620208016a1308ec0112024e481a0a4d616e636865737465726d7576a91417b363112d0b4907e7bf652c16c5261696179baf88acac5e7d1d000000001976a91488b3555c5e06d6049bbe5426b72512f6d568b9e388ac00000000\",\n \"inputs\": [\n {\n \"address\": \"myBbjcsUMBsTi5aA1Y3FQr3eXZHTkTKjGn\",\n \"amount\": \"5.969662\",\n \"confirmations\": 2,\n \"height\": 213,\n \"is_change\": true,\n \"is_mine\": true,\n \"nout\": 1,\n \"timestamp\": 1559011814,\n \"txid\": \"ad2d9b984b2a9e923b12f7652dd9a945664f647e9ead8779fd9b240a68301442\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"mhgGjVVY6kjrAxf2cz1ALfbst6CQhZ72qg\",\n \"amount\": \"1.0\",\n \"claim_id\": \"e90a079b038cabe2782bc6a5b4f55f4e5febc5a1\",\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#e90a079b038cabe2782bc6a5b4f55f4e5febc5a1\",\n \"signing_channel\": {\n \"address\": \"muK7TZrirA8yHzxFcXa51W7CjxbAho2Zua\",\n \"amount\": \"1.0\",\n \"claim_id\": \"682bdf7e3ea6564bcf8aebe3cf227544189d1a6d\",\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#682bdf7e3ea6564bcf8aebe3cf227544189d1a6d\",\n \"timestamp\": 1559011813,\n \"txid\": \"3f665f0ca3cbb19c3c75813a30cd8334d7738a20566f2aa7775ab024d6fedd64\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004eeccdcff00c8336c5d616fee009894e5cbbc2bbf9497021aabbde81beaf8e6edf423de4ff094a8d4e7ea87d9469fd7d3b834b80d9b330d2f7a887108c5ea9268\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n },\n \"timestamp\": null,\n \"txid\": \"5faad4dc0519a4861480b7386e58e0857801ec6d13ba2a308449546ce4d18928\",\n \"type\": \"claim\",\n \"value\": {\n \"author\": \"Picaso\",\n \"description\": \"A blank PNG that is 5x7.\",\n \"fee\": {\n \"address\": \"mhgGjVVY6kjrAxf2cz1ALfbst6CQhZ72qg\",\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\": \"1559011789\",\n \"source\": {\n \"hash\": \"6c7df435d412c603390f593ef658c199817c7830ba3f16b7eadd8f99fa50e85dbd0d2b3dc61eadc33fe096e3872d1545\",\n \"media_type\": \"image/png\",\n \"name\": \"tmpg0gz6g_3.png\",\n \"sd_hash\": \"a76d75a13ff15d946f929115e248dd411996abea4e1f37f73a72ba82fcd39a0dbbb3a3777e767984cd30e9eef2b68312\",\n \"size\": \"99\"\n },\n \"stream_type\": \"image\",\n \"tags\": [\n \"blank\",\n \"art\"\n ],\n Line truncated
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -2476,14 +2350,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\": \"mpDcDEwvfvETWqTDhddKLTzZZS2GBQWBqC\",\n \"amount\": \"1.0\",\n \"claim_id\": \"5d64500fb723eded83a41b0d5055f1783f019191\",\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#5d64500fb723eded83a41b0d5055f1783f019191\",\n \"signing_channel\": {\n \"address\": \"n3rBuPQB9qzAha4xU1uHyP5nmvR3WGq3r6\",\n \"amount\": \"1.0\",\n \"claim_id\": \"7ed794458d57978c49572424e1d32c7fa4d5325e\",\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#7ed794458d57978c49572424e1d32c7fa4d5325e\",\n \"timestamp\": 1561485089,\n \"txid\": \"0f7256329d0b2896d6f2472eea2614fbcf20ab6b22e27d168060ebb0adbaa6fa\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a0342000465bebc31803d2a7f0f037f696665d4d610abea2e518f906410163dec7513fc2b9a82ae0c4a15602f467d4c03823d72cf95c36fc6a87e963356e44db502027ae2\",\n \"public_key_id\": \"mrqYtVaoPEPqgyRPExUPi7PrYJ9nDc59yW\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n },\n \"timestamp\": 1561485090,\n \"txid\": \"dac2f1adaf5debd8cb377673b35ee4e6eb62ba7747b4440ffdb44d6875c2197e\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpzj1qbxfj\",\n \"sd_hash\": \"d85e47456630442a413f6cbedbdc4b0a5177770155d8a4523bbf2f301ebae95e0785cb475ca8d1a9d3cab54a05de64d3\",\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\": \"mg5Gn2NmJFVpZUU1ScVKf34KXVmJsrxXeu\",\n \"amount\": \"1.0\",\n \"claim_id\": \"ffdbe8f44f285fbc4a352763727abd86d17399c1\",\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#ffdbe8f44f285fbc4a352763727abd86d17399c1\",\n \"signing_channel\": {\n \"address\": \"muK7TZrirA8yHzxFcXa51W7CjxbAho2Zua\",\n \"amount\": \"1.0\",\n \"claim_id\": \"682bdf7e3ea6564bcf8aebe3cf227544189d1a6d\",\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#682bdf7e3ea6564bcf8aebe3cf227544189d1a6d\",\n \"timestamp\": 1559011813,\n \"txid\": \"3f665f0ca3cbb19c3c75813a30cd8334d7738a20566f2aa7775ab024d6fedd64\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004eeccdcff00c8336c5d616fee009894e5cbbc2bbf9497021aabbde81beaf8e6edf423de4ff094a8d4e7ea87d9469fd7d3b834b80d9b330d2f7a887108c5ea9268\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n },\n \"timestamp\": 1559011814,\n \"txid\": \"fa78db71b5e4205ec33a69106f9c9528ed9289fa3f8efc51baebe6e514247287\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmp6h32p99s\",\n \"sd_hash\": \"e38f25767c7619948832380b12def270aa244ee0b712020551198b2c587babb08583b7ad928ea08f71e1a6ced74836e0\",\n \"size\": \"11\"\n }\n },\n \"value_type\": \"stream\"\n }\n ]\n}"
|
||||
},
|
||||
{
|
||||
"title": "Paginate your stream claims",
|
||||
"curl": "curl -d'{\"method\": \"stream_list\", \"params\": {\"page\": 1, \"page_size\": 20}}' http://localhost:5279/",
|
||||
"lbrynet": "lbrynet stream list --page=1 --page_size=20",
|
||||
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"stream_list\", \"params\": {\"page\": 1, \"page_size\": 20}}).json()",
|
||||
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"items\": [\n {\n \"address\": \"mpDcDEwvfvETWqTDhddKLTzZZS2GBQWBqC\",\n \"amount\": \"1.0\",\n \"claim_id\": \"5d64500fb723eded83a41b0d5055f1783f019191\",\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#5d64500fb723eded83a41b0d5055f1783f019191\",\n \"signing_channel\": {\n \"address\": \"n3rBuPQB9qzAha4xU1uHyP5nmvR3WGq3r6\",\n \"amount\": \"1.0\",\n \"claim_id\": \"7ed794458d57978c49572424e1d32c7fa4d5325e\",\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#7ed794458d57978c49572424e1d32c7fa4d5325e\",\n \"timestamp\": 1561485089,\n \"txid\": \"0f7256329d0b2896d6f2472eea2614fbcf20ab6b22e27d168060ebb0adbaa6fa\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a0342000465bebc31803d2a7f0f037f696665d4d610abea2e518f906410163dec7513fc2b9a82ae0c4a15602f467d4c03823d72cf95c36fc6a87e963356e44db502027ae2\",\n \"public_key_id\": \"mrqYtVaoPEPqgyRPExUPi7PrYJ9nDc59yW\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n },\n \"timestamp\": 1561485090,\n \"txid\": \"dac2f1adaf5debd8cb377673b35ee4e6eb62ba7747b4440ffdb44d6875c2197e\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpzj1qbxfj\",\n \"sd_hash\": \"d85e47456630442a413f6cbedbdc4b0a5177770155d8a4523bbf2f301ebae95e0785cb475ca8d1a9d3cab54a05de64d3\",\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\": \"mg5Gn2NmJFVpZUU1ScVKf34KXVmJsrxXeu\",\n \"amount\": \"1.0\",\n \"claim_id\": \"ffdbe8f44f285fbc4a352763727abd86d17399c1\",\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#ffdbe8f44f285fbc4a352763727abd86d17399c1\",\n \"signing_channel\": {\n \"address\": \"muK7TZrirA8yHzxFcXa51W7CjxbAho2Zua\",\n \"amount\": \"1.0\",\n \"claim_id\": \"682bdf7e3ea6564bcf8aebe3cf227544189d1a6d\",\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#682bdf7e3ea6564bcf8aebe3cf227544189d1a6d\",\n \"timestamp\": 1559011813,\n \"txid\": \"3f665f0ca3cbb19c3c75813a30cd8334d7738a20566f2aa7775ab024d6fedd64\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004eeccdcff00c8336c5d616fee009894e5cbbc2bbf9497021aabbde81beaf8e6edf423de4ff094a8d4e7ea87d9469fd7d3b834b80d9b330d2f7a887108c5ea9268\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n },\n \"timestamp\": 1559011814,\n \"txid\": \"fa78db71b5e4205ec33a69106f9c9528ed9289fa3f8efc51baebe6e514247287\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmp6h32p99s\",\n \"sd_hash\": \"e38f25767c7619948832380b12def270aa244ee0b712020551198b2c587babb08583b7ad928ea08f71e1a6ced74836e0\",\n \"size\": \"11\"\n }\n },\n \"value_type\": \"stream\"\n }\n ],\n \"page\": 1,\n \"page_size\": 20,\n \"total_items\": 1,\n \"total_pages\": 1\n }\n}"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -2689,12 +2563,6 @@
|
||||
"description": "do not broadcast the transaction",
|
||||
"is_required": false
|
||||
},
|
||||
{
|
||||
"name": "blocking",
|
||||
"type": "bool",
|
||||
"description": "wait until transaction is in mempool",
|
||||
"is_required": false
|
||||
},
|
||||
{
|
||||
"name": "replace",
|
||||
"type": "bool",
|
||||
@@ -2706,10 +2574,10 @@
|
||||
"examples": [
|
||||
{
|
||||
"title": "Update a stream claim to add channel",
|
||||
"curl": "curl -d'{\"method\": \"stream_update\", \"params\": {\"claim_id\": \"5d64500fb723eded83a41b0d5055f1783f019191\", \"clear_fee\": false, \"tags\": [], \"clear_tags\": false, \"languages\": [], \"clear_languages\": false, \"locations\": [], \"clear_locations\": false, \"channel_id\": \"7ed794458d57978c49572424e1d32c7fa4d5325e\", \"clear_channel\": false, \"channel_account_id\": [], \"preview\": false, \"blocking\": false, \"replace\": false}}' http://localhost:5279/",
|
||||
"lbrynet": "lbrynet stream update 5d64500fb723eded83a41b0d5055f1783f019191 --channel_id=\"7ed794458d57978c49572424e1d32c7fa4d5325e\"",
|
||||
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"stream_update\", \"params\": {\"claim_id\": \"5d64500fb723eded83a41b0d5055f1783f019191\", \"clear_fee\": false, \"tags\": [], \"clear_tags\": false, \"languages\": [], \"clear_languages\": false, \"locations\": [], \"clear_locations\": false, \"channel_id\": \"7ed794458d57978c49572424e1d32c7fa4d5325e\", \"clear_channel\": false, \"channel_account_id\": [], \"preview\": false, \"blocking\": false, \"replace\": false}}).json()",
|
||||
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"0100000002feffe89027066ca89809e9766581444c21dc68ec78dd6feead9b9c945da683c9000000006b483045022100d50e402d04306f995730a8cce777723723fff2846104882c27008649b9aae9bf022050a7b0432dd4a4bfd050e53cb072769cbd812f80e497c5c4c4c3e41bdae2e2800121039efda2d8dd29b422fb044b6ccf6791ec3b0489713619b3f9dd9e8c89a4e54779ffffffffb48acb3a85b381bcc76c473f47f0b8a7123aca7b0f793d4db380a2c9093b00aa010000006b483045022100a6948b248bedc73306df727c5068a0c34be18d9dde725e20c841719c0efcaea902203a842193eb567f4abee70e7560732cad4e216863d4c4d1c892359cff4678c18e012103931d91a3c5ade5cdc8a50814a522fcd34a309a6704ff608db69a878d214f6db0ffffffff0200e1f50500000000fd2301b7076173747265616d149191013f78f155500d1ba483eded23b70f50645d4ce8015e32d5a47f2cd3e1242457498c97578d4594d77ee519fc56b21384e97c75d5c1b6450f2138e209f7bbd2adb588609ba36d1982a2187070c391a89793a0b569f09fef656fe041eab1809e3964f6346ae0fb3d20f30a90010a8d010a30fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd120b746d707a6a31716278666a180b22186170706c69636174696f6e2f6f637465742d73747265616d3230d85e47456630442a413f6cbedbdc4b0a5177770155d8a4523bbf2f301ebae95e0785cb475ca8d1a9d3cab54a05de64d36d6d76a9145f714bd8d8f78a7a6836eba4625ab0d05cbf9bf188ac32a0d205000000001976a9143b92d98084d9425628023c45e47f808c4abeacc588ac00000000\",\n \"inputs\": [\n {\n \"address\": \"mpDcDEwvfvETWqTDhddKLTzZZS2GBQWBqC\",\n \"amount\": \"1.0\",\n \"claim_id\": \"5d64500fb723eded83a41b0d5055f1783f019191\",\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#5d64500fb723eded83a41b0d5055f1783f019191\",\n \"timestamp\": 1561485090,\n \"txid\": \"c983a65d949c9badee6fdd78ec68dc214c44816576e90998a86c062790e8fffe\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmpzj1qbxfj\",\n \"sd_hash\": \"d85e47456630442a413f6cbedbdc4b0a5177770155d8a4523bbf2f301ebae95e0785cb475ca8d1a9d3cab54a05de64d3\",\n \"size\": \"11\"\n },\n \"stream_type\": \"binary\"\n },\n \"value_type\": \"stream\"\n },\n {\n \"address\": \"mrxs9s9nJgdvS6qW2ca4yr5UY6RkWS5zk9\",\n \"amount\": \"0.9772285\",\n \"confirmations\": 3,\n \"height\": 211,\n \"is_change\": true,\n \"is_mine\": true,\n \"nout\": 1,\n \"timestamp\": 1561485089,\n \"txid\": \"aa003b09c9a280b34d3d790f7bca3a12a7b8f0473f476cc7bc81b3853acb8ab4\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"mpDcDEwvfvETWqTDhddKLTzZZS2GBQWBqC\",\n \"amount\": \"1.0\",\n \"claim_id\": \"5d64500fb723eded83a41b0d5055f1783f019191\",\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#5d64500fb723eded83a41b0d5055f1783f019191\",\n \"signing_channel\": {\n \"address\": \"n3rBuPQB9qzAha4xU1uHyP5nmvR3WGq3r6\",\n \"amount\": \"1.0\",\n \"claim_id\": \"7ed794458d57978c49572424e1d32c7fa4d5325e\",\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#7ed794458d57978c49572424e1d32c7fa4d5325e\",\n \"timestamp\": 1561485089,\n \"txid\": \"0f7256329d0b2896d6f2472eea2614fbcf20ab6b22e27d168060ebb0adbaa6fa\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a0342000465bebc31803d2a7f0f037f696665d4d610abea2e518f906410163dec7513fc2b9a82ae0c4a15602f467d4c03823d72cf95c36fc6a87e963356e44db502027ae2\",\n \"public_key_id\": \"mrqYtVaoPEPqgyRPExUPi7PrYJ9nDc59yW\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n },\n \"timestamp\": null,\n \"txid\": \"dac2f1adaf5debd8cb377673b35ee4e6eb62ba7747b4440ffdb44d6875c2197e\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4Line truncated
|
||||
"curl": "curl -d'{\"method\": \"stream_update\", \"params\": {\"claim_id\": \"ffdbe8f44f285fbc4a352763727abd86d17399c1\", \"clear_fee\": false, \"tags\": [], \"clear_tags\": false, \"languages\": [], \"clear_languages\": false, \"locations\": [], \"clear_locations\": false, \"channel_id\": \"682bdf7e3ea6564bcf8aebe3cf227544189d1a6d\", \"clear_channel\": false, \"channel_account_id\": [], \"preview\": false, \"replace\": false}}' http://localhost:5279/",
|
||||
"lbrynet": "lbrynet stream update ffdbe8f44f285fbc4a352763727abd86d17399c1 --channel_id=\"682bdf7e3ea6564bcf8aebe3cf227544189d1a6d\"",
|
||||
"python": "requests.post(\"http://localhost:5279\", json={\"method\": \"stream_update\", \"params\": {\"claim_id\": \"ffdbe8f44f285fbc4a352763727abd86d17399c1\", \"clear_fee\": false, \"tags\": [], \"clear_tags\": false, \"languages\": [], \"clear_languages\": false, \"locations\": [], \"clear_locations\": false, \"channel_id\": \"682bdf7e3ea6564bcf8aebe3cf227544189d1a6d\", \"clear_channel\": false, \"channel_account_id\": [], \"preview\": false, \"replace\": false}}).json()",
|
||||
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": {\n \"height\": -2,\n \"hex\": \"0100000002421430680a249bfd7987ad9e7e644f6645a9d92d65f7123b929e2a4b989b2dad000000006a4730440220328e1833cbc85f07bb2a3b485a178c8ef50e0e11de1e029a3392cfcf3bf1d27302206a588363e64cb0e361cd6a9fe6f37067611bbe5eb3ed2271a6bb7f24e3fb72b0012102700c310dacc983a7cfe3187c0913373c956fbb5f850a13043c2897f2da825120ffffffffc912a1a678d1a646e6164f0e0c2d51e16fd6acaaa0dd4b1b8bf4780143c4b260010000006b483045022100d31bbf4ac9628ea729d0b4252b36e120c7dafdad9ada4207112423ec7dc748690220153223d7fa389287b7baea11e8c301b8607a602805c9f97c399f2eaa0c54d9f6012103a0263f43ab4d778afd664d54704040b580185511e529011f713976e3f0032647ffffffff0200e1f50500000000fd2301b7076173747265616d14c19973d186bd7a726327354abc5f284ff4e8dbff4ce8016d1a9d18447522cfe3eb8acf4b56a63e7edf2b68fdfdb7869eb7447ab2e61a2d5cdf8199867bda63dd1edc699b7dee31d618198502a11309baff2f6d52104f494ca48ff9e5961c5a00badba23fcfeb010f595fc10a90010a8d010a30fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd120b746d703668333270393973180b22186170706c69636174696f6e2f6f637465742d73747265616d3230e38f25767c7619948832380b12def270aa244ee0b712020551198b2c587babb08583b7ad928ea08f71e1a6ced74836e06d6d76a914061cbd2df8421ab14497e62baf747461c7c9137b88ac32a0d205000000001976a914f0d879252e7fcd69f489f40a6e7df12d95b9b5bc88ac00000000\",\n \"inputs\": [\n {\n \"address\": \"mg5Gn2NmJFVpZUU1ScVKf34KXVmJsrxXeu\",\n \"amount\": \"1.0\",\n \"claim_id\": \"ffdbe8f44f285fbc4a352763727abd86d17399c1\",\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#ffdbe8f44f285fbc4a352763727abd86d17399c1\",\n \"timestamp\": 1559011814,\n \"txid\": \"ad2d9b984b2a9e923b12f7652dd9a945664f647e9ead8779fd9b240a68301442\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"application/octet-stream\",\n \"name\": \"tmp6h32p99s\",\n \"sd_hash\": \"e38f25767c7619948832380b12def270aa244ee0b712020551198b2c587babb08583b7ad928ea08f71e1a6ced74836e0\",\n \"size\": \"11\"\n }\n },\n \"value_type\": \"stream\"\n },\n {\n \"address\": \"mnY3oi1Auwp7Cb4CQRGDLoKWwsARVzes45\",\n \"amount\": \"0.9772285\",\n \"confirmations\": 3,\n \"height\": 211,\n \"is_change\": true,\n \"is_mine\": true,\n \"nout\": 1,\n \"timestamp\": 1559011813,\n \"txid\": \"60b2c4430178f48b1b4bdda0aaacd66fe1512d0c0e4f16e646a6d178a6a112c9\",\n \"type\": \"payment\"\n }\n ],\n \"outputs\": [\n {\n \"address\": \"mg5Gn2NmJFVpZUU1ScVKf34KXVmJsrxXeu\",\n \"amount\": \"1.0\",\n \"claim_id\": \"ffdbe8f44f285fbc4a352763727abd86d17399c1\",\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#ffdbe8f44f285fbc4a352763727abd86d17399c1\",\n \"signing_channel\": {\n \"address\": \"muK7TZrirA8yHzxFcXa51W7CjxbAho2Zua\",\n \"amount\": \"1.0\",\n \"claim_id\": \"682bdf7e3ea6564bcf8aebe3cf227544189d1a6d\",\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#682bdf7e3ea6564bcf8aebe3cf227544189d1a6d\",\n \"timestamp\": 1559011813,\n \"txid\": \"3f665f0ca3cbb19c3c75813a30cd8334d7738a20566f2aa7775ab024d6fedd64\",\n \"type\": \"claim\",\n \"value\": {\n \"public_key\": \"3056301006072a8648ce3d020106052b8104000a03420004eeccdcff00c8336c5d616fee009894e5cbbc2bbf9497021aabbde81beaf8e6edf423de4ff094a8d4e7ea87d9469fd7d3b834b80d9b330d2f7a887108c5ea9268\",\n \"title\": \"New Channel\"\n },\n \"value_type\": \"channel\"\n },\n \"timestamp\": null,\n \"txid\": \"fa78db71b5e4205ec33a69106f9c9528ed9289fa3f8efc51baebe6e514247287\",\n \"type\": \"claim\",\n \"value\": {\n \"source\": {\n \"hash\": \"fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd\",\n \"media_type\": \"appLine truncated
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -2801,12 +2669,6 @@
|
||||
"type": "bool",
|
||||
"description": "do not broadcast the transaction",
|
||||
"is_required": false
|
||||
},
|
||||
{
|
||||
"name": "blocking",
|
||||
"type": "bool",
|
||||
"description": "wait until transaction is in mempool",
|
||||
"is_required": false
|
||||
}
|
||||
],
|
||||
"returns": " {\n \"txid\": \"hash of transaction in hex\",\n \"height\": \"block where transaction was recorded\",\n \"inputs\": [\n {\n \"txid\": \"hash of transaction in hex\",\n \"nout\": \"position in the transaction\",\n \"height\": \"block where transaction was recorded\",\n \"amount\": \"value of the txo as a decimal\",\n \"address\": \"address of who can spend the txo\",\n \"confirmations\": \"number of confirmed blocks\",\n \"is_change\": \"payment to change address, only available when it can be determined\",\n \"is_mine\": \"payment to one of your accounts, only available when it can be determined\",\n \"type\": \"one of 'claim', 'support' or 'payment'\",\n \"name\": \"when type is 'claim' or 'support', this is the claim name\",\n \"claim_id\": \"when type is 'claim' or 'support', this is the claim id\",\n \"claim_op\": \"when type is 'claim', this determines if it is 'create' or 'update'\",\n \"value\": \"when type is 'claim' or 'support' with payload, this is the decoded protobuf payload\",\n \"value_type\": \"determines the type of the 'value' field: 'channel', 'stream', etc\",\n \"protobuf\": \"hex encoded raw protobuf version of 'value' field\",\n \"permanent_url\": \"when type is 'claim' or 'support', this is the long permanent claim URL\",\n \"signing_channel\": \"for signed claims only, metadata of signing channel\",\n \"is_channel_signature_valid\": \"for signed claims only, whether signature is valid\"\n }\n ],\n \"outputs\": [\n {\n \"txid\": \"hash of transaction in hex\",\n \"nout\": \"position in the transaction\",\n \"height\": \"block where transaction was recorded\",\n \"amount\": \"value of the txo as a decimal\",\n \"address\": \"address of who can spend the txo\",\n \"confirmations\": \"number of confirmed blocks\",\n \"is_change\": \"payment to change address, only available when it can be determined\",\n \"is_mine\": \"payment to one of your accounts, only available when it can be determined\",\n \"type\": \"one of 'claim', 'support' or 'payment'\",\n \"name\": \"when type is 'claim' or 'support', this is the claim name\",\n \"claim_id\": \"when type is 'claim' or 'support', this is the claim id\",\n \"claim_op\": \"when type is 'claim', this determines if it is 'create' or 'update'\",\n \"value\": \"when type is 'claim' or 'support' with payload, this is the decoded protobuf payload\",\n \"value_type\": \"determines the type of the 'value' field: 'channel', 'stream', etc\",\n \"protobuf\": \"hex encoded raw protobuf version of 'value' field\",\n \"permanent_url\": \"when type is 'claim' or 'support', this is the long permanent claim URL\",\n \"signing_channel\": \"for signed claims only, metadata of signing channel\",\n \"is_channel_signature_valid\": \"for signed claims only, whether signature is valid\"\n }\n ],\n \"total_input\": \"sum of inputs as a decimal\",\n \"total_output\": \"sum of outputs, sans fee, as a decimal\",\n \"total_fee\": \"fee amount\",\n \"hex\": \"entire transaction encoded in hex\"\n }",
|
||||
@@ -2911,7 +2773,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-06-25 13:51\",\n \"fee\": \"-0.000124\",\n \"support_info\": [],\n \"timestamp\": 1561485089,\n \"txid\": \"0e071fe12cfda37fb80dd634afb1a44bcb861e2de16009ad5628cc7f74776634\",\n \"update_info\": [],\n \"value\": \"-2.0\"\n },\n {\n \"abandon_info\": [],\n \"claim_info\": [],\n \"confirmations\": 7,\n \"date\": \"2019-06-25 13:51\",\n \"fee\": \"0.0\",\n \"support_info\": [],\n \"timestamp\": 1561485088,\n \"txid\": \"8fa093f2b4e99c1c7d1aef71a73092c72ebe1875a2481b2ccb4244a49126fcc0\",\n \"update_info\": [],\n \"value\": \"10.0\"\n }\n ]\n}"
|
||||
"output": "{\n \"jsonrpc\": \"2.0\",\n \"result\": [\n {\n \"abandon_info\": [],\n \"claim_info\": [],\n \"confirmations\": 1,\n \"date\": \"2019-05-27 22:50\",\n \"fee\": \"-0.000124\",\n \"support_info\": [],\n \"timestamp\": 1559011813,\n \"txid\": \"3ef83205dd764152fc6847fc9c80b94251b5306152d0747d619f8da4e037145b\",\n \"update_info\": [],\n \"value\": \"-2.0\"\n },\n {\n \"abandon_info\": [],\n \"claim_info\": [],\n \"confirmations\": 7,\n \"date\": \"2019-05-27 22:50\",\n \"fee\": \"0.0\",\n \"support_info\": [],\n \"timestamp\": 1559011812,\n \"txid\": \"4717af0744c6d4f85cf43cc371161d8f8857e5fd1e4c1040deb1c07cb9efa0ff\",\n \"update_info\": [],\n \"value\": \"10.0\"\n }\n ]\n}"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
Before Width: | Height: | Size: 521 B After Width: | Height: | Size: 521 B |
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 7.4 KiB After Width: | Height: | Size: 7.4 KiB |
|
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 19 KiB |
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 2.6 KiB |
|
Before Width: | Height: | Size: 6.1 KiB After Width: | Height: | Size: 6.1 KiB |
|
Before Width: | Height: | Size: 97 KiB After Width: | Height: | Size: 97 KiB |
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 361 KiB After Width: | Height: | Size: 361 KiB |
|
Before Width: | Height: | Size: 5.3 KiB After Width: | Height: | Size: 5.3 KiB |
|
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 31 KiB After Width: | Height: | Size: 31 KiB |
|
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 2.6 KiB |
@@ -1,13 +0,0 @@
|
||||
.DS_Store
|
||||
/build
|
||||
/dist
|
||||
/.tox
|
||||
/.idea
|
||||
/.coverage
|
||||
/lbry-venv
|
||||
|
||||
lbry.egg-info
|
||||
__pycache__
|
||||
_trial_temp/
|
||||
|
||||
/tests/integration/files
|
||||
@@ -1,56 +0,0 @@
|
||||
# <img src="https://raw.githubusercontent.com/lbryio/lbry-sdk/master/lbry/lbry.png" alt="LBRY" width="48" height="36" /> LBRY SDK [](https://travis-ci.org/lbryio/lbry-sdk) [](https://codecov.io/gh/lbryio/lbry-sdk)
|
||||
|
||||
LBRY is a decentralized peer-to-peer protocol for publishing and accessing digital content. It utilizes the [LBRY blockchain](https://github.com/lbryio/lbrycrd) as a global namespace and database of digital content. Blockchain entries contain searchable content metadata, identities, rights and access rules. LBRY also provides a data network that consists of peers (seeders) uploading and downloading data from other peers, possibly in exchange for payments, as well as a distributed hash table used by peers to discover other peers.
|
||||
|
||||
LBRY SDK for Python is currently the most full featured implementation of the LBRY Network protocols and includes many useful components and tools for building decentralized applications. Primary features and components:
|
||||
|
||||
* Built on Python 3.7+ and `asyncio`.
|
||||
* Kademlia DHT (Distributed Hash Table) implementation for finding peers to download from and announcing to peers what we have to host ([lbry.dht](https://github.com/lbryio/lbry-sdk/tree/master/lbry/lbry/dht)).
|
||||
* Blob exchange protocol for transferring encrypted blobs of content and negotiating payments ([lbry.blob_exchange](https://github.com/lbryio/lbry-sdk/tree/master/lbry/lbry/blob_exchange)).
|
||||
* Protobuf schema for encoding and decoding metadata stored on the blockchain ([lbry.schema](https://github.com/lbryio/lbry-sdk/tree/master/lbry/lbry/schema)).
|
||||
* Wallet implementation for the LBRY blockchain ([lbry.wallet](https://github.com/lbryio/lbry-sdk/tree/master/lbry/lbry/wallet)).
|
||||
* Daemon with a JSON-RPC API to ease building end user applications in any language and for automating various tasks ([lbry.extras.daemon](https://github.com/lbryio/lbry-sdk/tree/master/lbry/lbry/extras/daemon)).
|
||||
|
||||
## Installation
|
||||
|
||||
Our [releases page](https://github.com/lbryio/lbry-sdk/releases) contains pre-built binaries of the latest release, pre-releases, and past releases for macOS, Debian-based Linux, and Windows. [Automated travis builds](http://build.lbry.io/daemon/) are also available for testing.
|
||||
|
||||
## Usage
|
||||
|
||||
Run `lbrynet start` to launch the API server.
|
||||
|
||||
By default, `lbrynet` will provide a JSON-RPC server at `http://localhost:5279`. It is easy to interact with via cURL or sane programming languages.
|
||||
|
||||
Our [quickstart guide](https://lbry.tech/playground) provides a simple walkthrough and examples for learning.
|
||||
|
||||
With the daemon running, `lbrynet commands` will show you a list of commands.
|
||||
|
||||
The full API is documented [here](https://lbry.tech/api/sdk).
|
||||
|
||||
## Running from source
|
||||
|
||||
Installing from source is also relatively painless. Full instructions are in [INSTALL.md](INSTALL.md)
|
||||
|
||||
## Contributing
|
||||
|
||||
Contributions to this project are welcome, encouraged, and compensated. For more details, please check [this](https://lbry.tech/contribute) link.
|
||||
|
||||
## License
|
||||
|
||||
This project is MIT licensed. For the full license, see [LICENSE](LICENSE).
|
||||
|
||||
## Security
|
||||
|
||||
We take security seriously. Please contact security@lbry.com regarding any security issues. [Our GPG key is here](https://lbry.com/faq/gpg-key) if you need it.
|
||||
|
||||
## Contact
|
||||
|
||||
The primary contact for this project is [@eukreign](mailto:lex@lbry.com).
|
||||
|
||||
## Additional information and links
|
||||
|
||||
The documentation for the API can be found [here](https://lbry.tech/api/sdk).
|
||||
|
||||
Daemon defaults, ports, and other settings are documented [here](https://lbry.tech/resources/daemon-settings).
|
||||
|
||||
Settings can be configured using a daemon-settings.yml file. An example can be found [here](https://github.com/lbryio/lbry-sdk/blob/master/lbry/example_daemon_settings.yml).
|
||||
@@ -1,4 +0,0 @@
|
||||
__name__ = "lbry"
|
||||
__version__ = "0.38.7"
|
||||
version = tuple(__version__.split('.'))
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
from lbry.extras.daemon import Components # register Component classes
|
||||
@@ -1,67 +0,0 @@
|
||||
import logging
|
||||
import time
|
||||
import hashlib
|
||||
import binascii
|
||||
|
||||
from lbry import utils
|
||||
import ecdsa
|
||||
from torba.client.hash import sha256
|
||||
from lbry.wallet.transaction import Output
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def get_encoded_signature(signature):
|
||||
signature = signature.encode() if type(signature) is str else signature
|
||||
r = int(signature[:int(len(signature) / 2)], 16)
|
||||
s = int(signature[int(len(signature) / 2):], 16)
|
||||
return ecdsa.util.sigencode_der(r, s, len(signature) * 4)
|
||||
|
||||
|
||||
def cid2hash(claim_id: str) -> bytes:
|
||||
return binascii.unhexlify(claim_id.encode())[::-1]
|
||||
|
||||
|
||||
def is_comment_signed_by_channel(comment: dict, channel: Output, abandon=False):
|
||||
if type(channel) is Output:
|
||||
try:
|
||||
signing_field = comment['comment_id'] if abandon else comment['comment']
|
||||
pieces = [
|
||||
comment['signing_ts'].encode(),
|
||||
cid2hash(comment['channel_id']),
|
||||
signing_field.encode()
|
||||
]
|
||||
return Output.is_signature_valid(
|
||||
get_encoded_signature(comment['signature']),
|
||||
sha256(b''.join(pieces)),
|
||||
channel.claim.channel.public_key_bytes
|
||||
)
|
||||
except KeyError:
|
||||
pass
|
||||
return False
|
||||
|
||||
|
||||
def sign_comment(comment: dict, channel: Output, abandon=False):
|
||||
timestamp = str(int(time.time()))
|
||||
signing_field = comment['comment_id'] if abandon else comment['comment']
|
||||
pieces = [timestamp.encode(), channel.claim_hash, signing_field.encode()]
|
||||
digest = sha256(b''.join(pieces))
|
||||
signature = channel.private_key.sign_digest_deterministic(digest, hashfunc=hashlib.sha256)
|
||||
comment.update({
|
||||
'signature': binascii.hexlify(signature).decode(),
|
||||
'signing_ts': timestamp
|
||||
})
|
||||
|
||||
|
||||
async def jsonrpc_post(url: str, method: str, params: dict = None, **kwargs) -> any:
|
||||
params = params or {}
|
||||
params.update(kwargs)
|
||||
json_body = {'jsonrpc': '2.0', 'id': None, 'method': method, 'params': params}
|
||||
headers = {'Content-Type': 'application/json'}
|
||||
async with utils.aiohttp_request('POST', url, json=json_body, headers=headers) as response:
|
||||
try:
|
||||
result = await response.json()
|
||||
return result['result'] if 'result' in result else result
|
||||
except Exception as cte:
|
||||
log.exception('Unable to decode response from server: %s', cte)
|
||||
return await response.text()
|
||||
@@ -1,13 +0,0 @@
|
||||
from typing import List
|
||||
import re
|
||||
|
||||
MULTI_SPACE_RE = re.compile(r"\s{2,}")
|
||||
WEIRD_CHARS_RE = re.compile(r"[#!~]")
|
||||
|
||||
|
||||
def normalize_tag(tag: str):
|
||||
return MULTI_SPACE_RE.sub(' ', WEIRD_CHARS_RE.sub(' ', tag.lower().replace("'", ""))).strip()
|
||||
|
||||
|
||||
def clean_tags(tags: List[str]):
|
||||
return [tag for tag in set(normalize_tag(tag) for tag in tags) if tag]
|
||||
@@ -1,11 +0,0 @@
|
||||
__node_daemon__ = 'lbrycrdd'
|
||||
__node_cli__ = 'lbrycrd-cli'
|
||||
__node_bin__ = ''
|
||||
__node_url__ = (
|
||||
'https://github.com/lbryio/lbrycrd/releases/download/v0.12.4.1/lbrycrd-linux.zip'
|
||||
)
|
||||
__spvserver__ = 'lbry.wallet.server.coin.LBCRegTest'
|
||||
|
||||
from lbry.wallet.manager import LbryWalletManager
|
||||
from lbry.wallet.network import Network
|
||||
from lbry.wallet.ledger import MainNetLedger, RegTestLedger, TestNetLedger
|
||||
@@ -1,220 +0,0 @@
|
||||
CLAIM_TYPES = {
|
||||
'stream': 1,
|
||||
'channel': 2,
|
||||
}
|
||||
|
||||
STREAM_TYPES = {
|
||||
'video': 1,
|
||||
'audio': 2,
|
||||
'image': 3,
|
||||
'document': 4,
|
||||
'binary': 5,
|
||||
'model': 6
|
||||
}
|
||||
|
||||
MATURE_TAGS = [
|
||||
'nsfw', 'porn', 'xxx', 'mature', 'adult', 'sex'
|
||||
]
|
||||
|
||||
COMMON_TAGS = {
|
||||
"gaming": "gaming",
|
||||
"people & blogs": "people_and_blogs",
|
||||
"pop culture": "pop_culture",
|
||||
"entertainment": "entertainment",
|
||||
"technology": "technology",
|
||||
"music": "music",
|
||||
"funny": "funny",
|
||||
"education": "education",
|
||||
"learning": "learning",
|
||||
"news": "news",
|
||||
"gameplay": "gameplay",
|
||||
"science & technology": "science_and_technology",
|
||||
"playstation 4": "playstation_4",
|
||||
"beliefs": "beliefs",
|
||||
"nature": "nature",
|
||||
"news & politics": "news_and_politics",
|
||||
"comedy": "comedy",
|
||||
"games": "games",
|
||||
"sony interactive entertainment": "sony_interactive_entertainment",
|
||||
"film & animation": "film_and_animation",
|
||||
"game": "game",
|
||||
"howto & style": "howto_and_style",
|
||||
"weapons": "weapons",
|
||||
"blockchain": "blockchain",
|
||||
"video game": "video_game",
|
||||
"sports": "sports",
|
||||
"walkthrough": "walkthrough",
|
||||
"ps4live": "ps4live",
|
||||
"art": "art",
|
||||
"pc": "pc",
|
||||
"economics": "economics",
|
||||
"automotive": "automotive",
|
||||
"minecraft": "minecraft",
|
||||
"playthrough": "playthrough",
|
||||
"ps4share": "ps4share",
|
||||
"tutorial": "tutorial",
|
||||
"play": "play",
|
||||
"twitch": "twitch",
|
||||
"how to": "how_to",
|
||||
"ps4": "ps4",
|
||||
"bitcoin": "bitcoin",
|
||||
"fortnite": "fortnite",
|
||||
"commentary": "commentary",
|
||||
"lets play": "lets_play",
|
||||
"fun": "fun",
|
||||
"politics": "politics",
|
||||
"xbox": "xbox",
|
||||
"autos & vehicles": "autos_and_vehicles",
|
||||
"travel & events": "travel_and_events",
|
||||
"food": "food",
|
||||
"science": "science",
|
||||
"mature": "mature",
|
||||
"xbox one": "xbox_one",
|
||||
"liberal": "liberal",
|
||||
"democrat": "democrat",
|
||||
"progressive": "progressive",
|
||||
"survival": "survival",
|
||||
"nonprofits & activism": "nonprofits_and_activism",
|
||||
"cryptocurrency": "cryptocurrency",
|
||||
"playstation": "playstation",
|
||||
"nintendo": "nintendo",
|
||||
"government": "government",
|
||||
"steam": "steam",
|
||||
"podcast": "podcast",
|
||||
"horror": "horror",
|
||||
"conservative": "conservative",
|
||||
"reaction": "reaction",
|
||||
"trailer": "trailer",
|
||||
"love": "love",
|
||||
"cnn": "cnn",
|
||||
"republican": "republican",
|
||||
"gamer": "gamer",
|
||||
"political": "political",
|
||||
"hangoutsonair": "hangoutsonair",
|
||||
"hoa": "hoa",
|
||||
"msnbc": "msnbc",
|
||||
"cbs": "cbs",
|
||||
"donald trump": "donald_trump",
|
||||
"fiction": "fiction",
|
||||
"fox news": "fox_news",
|
||||
"anime": "anime",
|
||||
"crypto": "crypto",
|
||||
"ethereum": "ethereum",
|
||||
"call of duty": "call_of_duty",
|
||||
"multiplayer": "multiplayer",
|
||||
"android": "android",
|
||||
"epic": "epic",
|
||||
"rpg": "rpg",
|
||||
"adventure": "adventure",
|
||||
"secular talk": "secular_talk",
|
||||
"btc": "btc",
|
||||
"atheist": "atheist",
|
||||
"atheism": "atheism",
|
||||
"ps3": "ps3",
|
||||
"video games": "video_games",
|
||||
"cod": "cod",
|
||||
"agnostic": "agnostic",
|
||||
"movie": "movie",
|
||||
"online": "online",
|
||||
"fps": "fps",
|
||||
"mod": "mod",
|
||||
"reviews": "reviews",
|
||||
"sharefactory": "sharefactory",
|
||||
"world": "world",
|
||||
"space": "space",
|
||||
"hilarious": "hilarious",
|
||||
"stream": "stream",
|
||||
"lol": "lol",
|
||||
"sony": "sony",
|
||||
"god": "god",
|
||||
"lets": "lets",
|
||||
"dance": "dance",
|
||||
"pvp": "pvp",
|
||||
"tech": "tech",
|
||||
"zombies": "zombies",
|
||||
"pokemon": "pokemon",
|
||||
"fail": "fail",
|
||||
"xbox 360": "xbox_360",
|
||||
"film": "film",
|
||||
"unboxing": "unboxing",
|
||||
"animation": "animation",
|
||||
"travel": "travel",
|
||||
"money": "money",
|
||||
"wwe": "wwe",
|
||||
"how": "how",
|
||||
"mods": "mods",
|
||||
"pubg": "pubg",
|
||||
"indie": "indie",
|
||||
"strategy": "strategy",
|
||||
"history": "history",
|
||||
"rap": "rap",
|
||||
"ios": "ios",
|
||||
"sony computer entertainment": "sony_computer_entertainment",
|
||||
"mobile": "mobile",
|
||||
"trump": "trump",
|
||||
"flat earth": "flat_earth",
|
||||
"hack": "hack",
|
||||
"trap": "trap",
|
||||
"fox": "fox",
|
||||
"vlogging": "vlogging",
|
||||
"news radio": "news_radio",
|
||||
"humor": "humor",
|
||||
"facebook": "facebook",
|
||||
"edm": "edm",
|
||||
"fitness": "fitness",
|
||||
"vaping": "vaping",
|
||||
"hip hop": "hip_hop",
|
||||
"secular": "secular",
|
||||
"jesus": "jesus",
|
||||
"vape": "vape",
|
||||
"song": "song",
|
||||
"remix": "remix",
|
||||
"guitar": "guitar",
|
||||
"daily": "daily",
|
||||
"mining": "mining",
|
||||
"diy": "diy",
|
||||
"videogame": "videogame",
|
||||
"pets & animals": "pets_and_animals",
|
||||
"funny moments": "funny_moments",
|
||||
"religion": "religion",
|
||||
"death": "death",
|
||||
"media": "media",
|
||||
"nbc": "nbc",
|
||||
"war": "war",
|
||||
"freedom": "freedom",
|
||||
"viral": "viral",
|
||||
"meme": "meme",
|
||||
"family": "family",
|
||||
"gold": "gold",
|
||||
"photography": "photography",
|
||||
"chill": "chill",
|
||||
"zombie": "zombie",
|
||||
"computer": "computer",
|
||||
"sniper": "sniper",
|
||||
"bible": "bible",
|
||||
"linux": "linux",
|
||||
"overwatch": "overwatch",
|
||||
"pro": "pro",
|
||||
"dragon": "dragon",
|
||||
"litecoin": "litecoin",
|
||||
"gta": "gta",
|
||||
"iphone": "iphone",
|
||||
"house": "house",
|
||||
"bass": "bass",
|
||||
"bitcoin news": "bitcoin_news",
|
||||
"wii": "wii",
|
||||
"crash": "crash",
|
||||
"league of legends": "league_of_legends",
|
||||
"grand theft auto v": "grand_theft_auto_v",
|
||||
"mario": "mario",
|
||||
"mmorpg": "mmorpg",
|
||||
"satire": "satire",
|
||||
"fire": "fire",
|
||||
"racing": "racing",
|
||||
"apple": "apple",
|
||||
"health": "health",
|
||||
"instrumental": "instrumental",
|
||||
"destiny": "destiny",
|
||||
"truth": "truth",
|
||||
"race": "race"
|
||||
}
|
||||
@@ -1,530 +0,0 @@
|
||||
import time
|
||||
import struct
|
||||
import sqlite3
|
||||
import logging
|
||||
from typing import Tuple, List, Dict, Union, Type, Optional
|
||||
from binascii import unhexlify
|
||||
from decimal import Decimal
|
||||
from contextvars import ContextVar
|
||||
from functools import wraps
|
||||
from dataclasses import dataclass
|
||||
|
||||
from torba.client.basedatabase import query, interpolate
|
||||
|
||||
from lbry.schema.url import URL, normalize_name
|
||||
from lbry.schema.tags import clean_tags
|
||||
from lbry.schema.result import Outputs
|
||||
from lbry.wallet.ledger import BaseLedger, MainNetLedger, RegTestLedger
|
||||
|
||||
from .common import CLAIM_TYPES, STREAM_TYPES, COMMON_TAGS
|
||||
|
||||
|
||||
class SQLiteOperationalError(sqlite3.OperationalError):
|
||||
def __init__(self, metrics):
|
||||
super().__init__('sqlite query errored')
|
||||
self.metrics = metrics
|
||||
|
||||
|
||||
class SQLiteInterruptedError(sqlite3.OperationalError):
|
||||
def __init__(self, metrics):
|
||||
super().__init__('sqlite query interrupted')
|
||||
self.metrics = metrics
|
||||
|
||||
|
||||
ATTRIBUTE_ARRAY_MAX_LENGTH = 100
|
||||
|
||||
|
||||
INTEGER_PARAMS = {
|
||||
'height', 'creation_height', 'activation_height', 'expiration_height',
|
||||
'timestamp', 'creation_timestamp', 'release_time', 'fee_amount',
|
||||
'tx_position', 'channel_join',
|
||||
'amount', 'effective_amount', 'support_amount',
|
||||
'trending_group', 'trending_mixed',
|
||||
'trending_local', 'trending_global',
|
||||
}
|
||||
|
||||
SEARCH_PARAMS = {
|
||||
'name', 'claim_id', 'txid', 'nout', 'channel', 'channel_ids', 'not_channel_ids',
|
||||
'public_key_id', 'claim_type', 'stream_types', 'media_types', 'fee_currency',
|
||||
'has_channel_signature', 'signature_valid',
|
||||
'any_tags', 'all_tags', 'not_tags',
|
||||
'any_locations', 'all_locations', 'not_locations',
|
||||
'any_languages', 'all_languages', 'not_languages',
|
||||
'is_controlling', 'limit', 'offset', 'order_by',
|
||||
'no_totals',
|
||||
} | INTEGER_PARAMS
|
||||
|
||||
|
||||
ORDER_FIELDS = {
|
||||
'name', 'claim_hash'
|
||||
} | INTEGER_PARAMS
|
||||
|
||||
|
||||
PRAGMAS = """
|
||||
pragma journal_mode=WAL;
|
||||
"""
|
||||
|
||||
|
||||
@dataclass
|
||||
class ReaderState:
|
||||
db: sqlite3.Connection
|
||||
stack: List[List]
|
||||
metrics: Dict
|
||||
is_tracking_metrics: bool
|
||||
ledger: Type[BaseLedger]
|
||||
query_timeout: float
|
||||
log: logging.Logger
|
||||
|
||||
def close(self):
|
||||
self.db.close()
|
||||
|
||||
def reset_metrics(self):
|
||||
self.stack = []
|
||||
self.metrics = {}
|
||||
|
||||
def set_query_timeout(self):
|
||||
stop_at = time.perf_counter() + self.query_timeout
|
||||
|
||||
def interruptor():
|
||||
if time.perf_counter() >= stop_at:
|
||||
self.db.interrupt()
|
||||
return
|
||||
|
||||
self.db.set_progress_handler(interruptor, 100)
|
||||
|
||||
|
||||
ctx: ContextVar[Optional[ReaderState]] = ContextVar('ctx')
|
||||
|
||||
|
||||
def initializer(log, _path, _ledger_name, query_timeout, _measure=False):
|
||||
db = sqlite3.connect(_path, isolation_level=None, uri=True)
|
||||
db.row_factory = sqlite3.Row
|
||||
ctx.set(
|
||||
ReaderState(
|
||||
db=db, stack=[], metrics={}, is_tracking_metrics=_measure,
|
||||
ledger=MainNetLedger if _ledger_name == 'mainnet' else RegTestLedger,
|
||||
query_timeout=query_timeout, log=log
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
def cleanup():
|
||||
ctx.get().close()
|
||||
ctx.set(None)
|
||||
|
||||
|
||||
def measure(func):
|
||||
@wraps(func)
|
||||
def wrapper(*args, **kwargs):
|
||||
state = ctx.get()
|
||||
if not state.is_tracking_metrics:
|
||||
return func(*args, **kwargs)
|
||||
metric = {}
|
||||
state.metrics.setdefault(func.__name__, []).append(metric)
|
||||
state.stack.append([])
|
||||
start = time.perf_counter()
|
||||
try:
|
||||
return func(*args, **kwargs)
|
||||
finally:
|
||||
elapsed = int((time.perf_counter()-start)*1000)
|
||||
metric['total'] = elapsed
|
||||
metric['isolated'] = (elapsed-sum(state.stack.pop()))
|
||||
if state.stack:
|
||||
state.stack[-1].append(elapsed)
|
||||
return wrapper
|
||||
|
||||
|
||||
def reports_metrics(func):
|
||||
@wraps(func)
|
||||
def wrapper(*args, **kwargs):
|
||||
state = ctx.get()
|
||||
if not state.is_tracking_metrics:
|
||||
return func(*args, **kwargs)
|
||||
state.reset_metrics()
|
||||
r = func(*args, **kwargs)
|
||||
return r, state.metrics
|
||||
return wrapper
|
||||
|
||||
|
||||
@reports_metrics
|
||||
def search_to_bytes(constraints) -> Union[bytes, Tuple[bytes, Dict]]:
|
||||
return encode_result(search(constraints))
|
||||
|
||||
|
||||
@reports_metrics
|
||||
def resolve_to_bytes(urls) -> Union[bytes, Tuple[bytes, Dict]]:
|
||||
return encode_result(resolve(urls))
|
||||
|
||||
|
||||
def encode_result(result):
|
||||
return Outputs.to_bytes(*result)
|
||||
|
||||
|
||||
@measure
|
||||
def execute_query(sql, values) -> List:
|
||||
context = ctx.get()
|
||||
context.set_query_timeout()
|
||||
try:
|
||||
return context.db.execute(sql, values).fetchall()
|
||||
except sqlite3.OperationalError as err:
|
||||
plain_sql = interpolate(sql, values)
|
||||
if context.is_tracking_metrics:
|
||||
context.metrics['execute_query'][-1]['sql'] = plain_sql
|
||||
if str(err) == "interrupted":
|
||||
context.log.warning("interrupted slow sqlite query:\n%s", plain_sql)
|
||||
raise SQLiteInterruptedError(context.metrics)
|
||||
context.log.exception('failed running query', exc_info=err)
|
||||
raise SQLiteOperationalError(context.metrics)
|
||||
|
||||
|
||||
def _get_claims(cols, for_count=False, **constraints) -> Tuple[str, Dict]:
|
||||
if 'order_by' in constraints:
|
||||
sql_order_by = []
|
||||
for order_by in constraints['order_by']:
|
||||
is_asc = order_by.startswith('^')
|
||||
column = order_by[1:] if is_asc else order_by
|
||||
if column not in ORDER_FIELDS:
|
||||
raise NameError(f'{column} is not a valid order_by field')
|
||||
if column == 'name':
|
||||
column = 'normalized'
|
||||
sql_order_by.append(
|
||||
f"claim.{column} ASC" if is_asc else f"claim.{column} DESC"
|
||||
)
|
||||
constraints['order_by'] = sql_order_by
|
||||
|
||||
ops = {'<=': '__lte', '>=': '__gte', '<': '__lt', '>': '__gt'}
|
||||
for constraint in INTEGER_PARAMS:
|
||||
if constraint in constraints:
|
||||
value = constraints.pop(constraint)
|
||||
postfix = ''
|
||||
if isinstance(value, str):
|
||||
if len(value) >= 2 and value[:2] in ops:
|
||||
postfix, value = ops[value[:2]], value[2:]
|
||||
elif len(value) >= 1 and value[0] in ops:
|
||||
postfix, value = ops[value[0]], value[1:]
|
||||
if constraint == 'fee_amount':
|
||||
value = Decimal(value)*1000
|
||||
constraints[f'claim.{constraint}{postfix}'] = int(value)
|
||||
|
||||
if constraints.pop('is_controlling', False):
|
||||
if {'sequence', 'amount_order'}.isdisjoint(constraints):
|
||||
for_count = False
|
||||
constraints['claimtrie.claim_hash__is_not_null'] = ''
|
||||
if 'sequence' in constraints:
|
||||
constraints['order_by'] = 'claim.activation_height ASC'
|
||||
constraints['offset'] = int(constraints.pop('sequence')) - 1
|
||||
constraints['limit'] = 1
|
||||
if 'amount_order' in constraints:
|
||||
constraints['order_by'] = 'claim.effective_amount DESC'
|
||||
constraints['offset'] = int(constraints.pop('amount_order')) - 1
|
||||
constraints['limit'] = 1
|
||||
|
||||
if 'claim_id' in constraints:
|
||||
claim_id = constraints.pop('claim_id')
|
||||
if len(claim_id) == 40:
|
||||
constraints['claim.claim_id'] = claim_id
|
||||
else:
|
||||
constraints['claim.claim_id__like'] = f'{claim_id[:40]}%'
|
||||
|
||||
if 'name' in constraints:
|
||||
constraints['claim.normalized'] = normalize_name(constraints.pop('name'))
|
||||
|
||||
if 'public_key_id' in constraints:
|
||||
constraints['claim.public_key_hash'] = sqlite3.Binary(
|
||||
ctx.get().ledger.address_to_hash160(constraints.pop('public_key_id')))
|
||||
if 'channel_hash' in constraints:
|
||||
constraints['claim.channel_hash'] = sqlite3.Binary(constraints.pop('channel_hash'))
|
||||
if 'channel_ids' in constraints:
|
||||
channel_ids = constraints.pop('channel_ids')
|
||||
if channel_ids:
|
||||
constraints['claim.channel_hash__in'] = [
|
||||
sqlite3.Binary(unhexlify(cid)[::-1]) for cid in channel_ids
|
||||
]
|
||||
if 'not_channel_ids' in constraints:
|
||||
not_channel_ids = constraints.pop('not_channel_ids')
|
||||
if not_channel_ids:
|
||||
not_channel_ids_binary = [
|
||||
sqlite3.Binary(unhexlify(ncid)[::-1]) for ncid in not_channel_ids
|
||||
]
|
||||
if constraints.get('has_channel_signature', False):
|
||||
constraints['claim.channel_hash__not_in'] = not_channel_ids_binary
|
||||
else:
|
||||
constraints['null_or_not_channel__or'] = {
|
||||
'claim.signature_valid__is_null': True,
|
||||
'claim.channel_hash__not_in': not_channel_ids_binary
|
||||
}
|
||||
if 'signature_valid' in constraints:
|
||||
has_channel_signature = constraints.pop('has_channel_signature', False)
|
||||
if has_channel_signature:
|
||||
constraints['claim.signature_valid'] = constraints.pop('signature_valid')
|
||||
else:
|
||||
constraints['null_or_signature__or'] = {
|
||||
'claim.signature_valid__is_null': True,
|
||||
'claim.signature_valid': constraints.pop('signature_valid')
|
||||
}
|
||||
elif constraints.pop('has_channel_signature', False):
|
||||
constraints['claim.signature_valid__is_not_null'] = True
|
||||
|
||||
if 'txid' in constraints:
|
||||
tx_hash = unhexlify(constraints.pop('txid'))[::-1]
|
||||
nout = constraints.pop('nout', 0)
|
||||
constraints['claim.txo_hash'] = sqlite3.Binary(
|
||||
tx_hash + struct.pack('<I', nout)
|
||||
)
|
||||
|
||||
if 'claim_type' in constraints:
|
||||
constraints['claim.claim_type'] = CLAIM_TYPES[constraints.pop('claim_type')]
|
||||
if 'stream_types' in constraints:
|
||||
stream_types = constraints.pop('stream_types')
|
||||
if stream_types:
|
||||
constraints['claim.stream_type__in'] = [
|
||||
STREAM_TYPES[stream_type] for stream_type in stream_types
|
||||
]
|
||||
if 'media_types' in constraints:
|
||||
media_types = constraints.pop('media_types')
|
||||
if media_types:
|
||||
constraints['claim.media_type__in'] = media_types
|
||||
|
||||
if 'fee_currency' in constraints:
|
||||
constraints['claim.fee_currency'] = constraints.pop('fee_currency').lower()
|
||||
|
||||
_apply_constraints_for_array_attributes(constraints, 'tag', clean_tags, for_count)
|
||||
_apply_constraints_for_array_attributes(constraints, 'language', lambda _: _, for_count)
|
||||
_apply_constraints_for_array_attributes(constraints, 'location', lambda _: _, for_count)
|
||||
|
||||
select = f"SELECT {cols} FROM claim"
|
||||
|
||||
sql, values = query(
|
||||
select if for_count else select+"""
|
||||
LEFT JOIN claimtrie USING (claim_hash)
|
||||
LEFT JOIN claim as channel ON (claim.channel_hash=channel.claim_hash)
|
||||
""", **constraints
|
||||
)
|
||||
return sql, values
|
||||
|
||||
|
||||
def get_claims(cols, for_count=False, **constraints) -> List:
|
||||
if 'channel' in constraints:
|
||||
channel_url = constraints.pop('channel')
|
||||
match = resolve_url(channel_url)
|
||||
if isinstance(match, sqlite3.Row):
|
||||
constraints['channel_hash'] = match['claim_hash']
|
||||
else:
|
||||
return [[0]] if cols == 'count(*)' else []
|
||||
sql, values = _get_claims(cols, for_count, **constraints)
|
||||
return execute_query(sql, values)
|
||||
|
||||
|
||||
@measure
|
||||
def get_claims_count(**constraints) -> int:
|
||||
constraints.pop('offset', None)
|
||||
constraints.pop('limit', None)
|
||||
constraints.pop('order_by', None)
|
||||
count = get_claims('count(*)', for_count=True, **constraints)
|
||||
return count[0][0]
|
||||
|
||||
|
||||
@measure
|
||||
def search(constraints) -> Tuple[List, List, int, int]:
|
||||
assert set(constraints).issubset(SEARCH_PARAMS), \
|
||||
f"Search query contains invalid arguments: {set(constraints).difference(SEARCH_PARAMS)}"
|
||||
total = None
|
||||
if not constraints.pop('no_totals', False):
|
||||
total = get_claims_count(**constraints)
|
||||
constraints['offset'] = abs(constraints.get('offset', 0))
|
||||
constraints['limit'] = min(abs(constraints.get('limit', 10)), 50)
|
||||
if 'order_by' not in constraints:
|
||||
constraints['order_by'] = ["claim_hash"]
|
||||
txo_rows = _search(**constraints)
|
||||
channel_hashes = set(txo['channel_hash'] for txo in txo_rows if txo['channel_hash'])
|
||||
extra_txo_rows = []
|
||||
if channel_hashes:
|
||||
extra_txo_rows = _search(
|
||||
**{'claim.claim_hash__in': [sqlite3.Binary(h) for h in channel_hashes]}
|
||||
)
|
||||
return txo_rows, extra_txo_rows, constraints['offset'], total
|
||||
|
||||
|
||||
def _search(**constraints):
|
||||
return get_claims(
|
||||
"""
|
||||
claimtrie.claim_hash as is_controlling,
|
||||
claimtrie.last_take_over_height,
|
||||
claim.claim_hash, claim.txo_hash,
|
||||
claim.claims_in_channel,
|
||||
claim.height, claim.creation_height,
|
||||
claim.activation_height, claim.expiration_height,
|
||||
claim.effective_amount, claim.support_amount,
|
||||
claim.trending_group, claim.trending_mixed,
|
||||
claim.trending_local, claim.trending_global,
|
||||
claim.short_url, claim.canonical_url,
|
||||
claim.channel_hash, channel.txo_hash AS channel_txo_hash,
|
||||
channel.height AS channel_height, claim.signature_valid
|
||||
""", **constraints
|
||||
)
|
||||
|
||||
|
||||
@measure
|
||||
def resolve(urls) -> Tuple[List, List]:
|
||||
result = []
|
||||
channel_hashes = set()
|
||||
for raw_url in urls:
|
||||
match = resolve_url(raw_url)
|
||||
result.append(match)
|
||||
if isinstance(match, sqlite3.Row) and match['channel_hash']:
|
||||
channel_hashes.add(match['channel_hash'])
|
||||
extra_txo_rows = []
|
||||
if channel_hashes:
|
||||
extra_txo_rows = _search(
|
||||
**{'claim.claim_hash__in': [sqlite3.Binary(h) for h in channel_hashes]}
|
||||
)
|
||||
return result, extra_txo_rows
|
||||
|
||||
|
||||
@measure
|
||||
def resolve_url(raw_url):
|
||||
|
||||
try:
|
||||
url = URL.parse(raw_url)
|
||||
except ValueError as e:
|
||||
return e
|
||||
|
||||
channel = None
|
||||
|
||||
if url.has_channel:
|
||||
query = url.channel.to_dict()
|
||||
if set(query) == {'name'}:
|
||||
query['is_controlling'] = True
|
||||
else:
|
||||
query['order_by'] = ['^height']
|
||||
matches = _search(**query, limit=1)
|
||||
if matches:
|
||||
channel = matches[0]
|
||||
else:
|
||||
return LookupError(f'Could not find channel in "{raw_url}".')
|
||||
|
||||
if url.has_stream:
|
||||
query = url.stream.to_dict()
|
||||
if channel is not None:
|
||||
if set(query) == {'name'}:
|
||||
# temporarily emulate is_controlling for claims in channel
|
||||
query['order_by'] = ['effective_amount', '^height']
|
||||
else:
|
||||
query['order_by'] = ['^channel_join']
|
||||
query['channel_hash'] = channel['claim_hash']
|
||||
query['signature_valid'] = 1
|
||||
elif set(query) == {'name'}:
|
||||
query['is_controlling'] = 1
|
||||
matches = _search(**query, limit=1)
|
||||
if matches:
|
||||
return matches[0]
|
||||
else:
|
||||
return LookupError(f'Could not find stream in "{raw_url}".')
|
||||
|
||||
return channel
|
||||
|
||||
|
||||
def _apply_constraints_for_array_attributes(constraints, attr, cleaner, for_count=False):
|
||||
any_items = set(cleaner(constraints.pop(f'any_{attr}s', []))[:ATTRIBUTE_ARRAY_MAX_LENGTH])
|
||||
all_items = set(cleaner(constraints.pop(f'all_{attr}s', []))[:ATTRIBUTE_ARRAY_MAX_LENGTH])
|
||||
not_items = set(cleaner(constraints.pop(f'not_{attr}s', []))[:ATTRIBUTE_ARRAY_MAX_LENGTH])
|
||||
|
||||
all_items = {item for item in all_items if item not in not_items}
|
||||
any_items = {item for item in any_items if item not in not_items}
|
||||
|
||||
any_queries = {}
|
||||
|
||||
if attr == 'tag':
|
||||
common_tags = any_items & COMMON_TAGS.keys()
|
||||
if common_tags:
|
||||
any_items -= common_tags
|
||||
if len(common_tags) < 5:
|
||||
for item in common_tags:
|
||||
index_name = COMMON_TAGS[item]
|
||||
any_queries[f'#_common_tag_{index_name}'] = f"""
|
||||
EXISTS(
|
||||
SELECT 1 FROM tag INDEXED BY tag_{index_name}_idx WHERE claim.claim_hash=tag.claim_hash
|
||||
AND tag = '{item}'
|
||||
)
|
||||
"""
|
||||
elif len(common_tags) >= 5:
|
||||
constraints.update({
|
||||
f'$any_common_tag{i}': item for i, item in enumerate(common_tags)
|
||||
})
|
||||
values = ', '.join(
|
||||
f':$any_common_tag{i}' for i in range(len(common_tags))
|
||||
)
|
||||
any_queries[f'#_any_common_tags'] = f"""
|
||||
EXISTS(
|
||||
SELECT 1 FROM tag WHERE claim.claim_hash=tag.claim_hash
|
||||
AND tag IN ({values})
|
||||
)
|
||||
"""
|
||||
|
||||
if any_items:
|
||||
|
||||
constraints.update({
|
||||
f'$any_{attr}{i}': item for i, item in enumerate(any_items)
|
||||
})
|
||||
values = ', '.join(
|
||||
f':$any_{attr}{i}' for i in range(len(any_items))
|
||||
)
|
||||
if for_count or attr == 'tag':
|
||||
any_queries[f'claim.claim_hash__in#_any_{attr}'] = f"""
|
||||
SELECT claim_hash FROM {attr} WHERE {attr} IN ({values})
|
||||
"""
|
||||
else:
|
||||
any_queries[f'#_any_{attr}'] = f"""
|
||||
EXISTS(
|
||||
SELECT 1 FROM {attr} WHERE
|
||||
claim.claim_hash={attr}.claim_hash
|
||||
AND {attr} IN ({values})
|
||||
)
|
||||
"""
|
||||
|
||||
if len(any_queries) == 1:
|
||||
constraints.update(any_queries)
|
||||
elif len(any_queries) > 1:
|
||||
constraints[f'ORed_{attr}_queries__any'] = any_queries
|
||||
|
||||
if all_items:
|
||||
constraints[f'$all_{attr}_count'] = len(all_items)
|
||||
constraints.update({
|
||||
f'$all_{attr}{i}': item for i, item in enumerate(all_items)
|
||||
})
|
||||
values = ', '.join(
|
||||
f':$all_{attr}{i}' for i in range(len(all_items))
|
||||
)
|
||||
if for_count:
|
||||
constraints[f'claim.claim_hash__in#_all_{attr}'] = f"""
|
||||
SELECT claim_hash FROM {attr} WHERE {attr} IN ({values})
|
||||
GROUP BY claim_hash HAVING COUNT({attr}) = :$all_{attr}_count
|
||||
"""
|
||||
else:
|
||||
constraints[f'#_all_{attr}'] = f"""
|
||||
{len(all_items)}=(
|
||||
SELECT count(*) FROM {attr} WHERE
|
||||
claim.claim_hash={attr}.claim_hash
|
||||
AND {attr} IN ({values})
|
||||
)
|
||||
"""
|
||||
|
||||
if not_items:
|
||||
constraints.update({
|
||||
f'$not_{attr}{i}': item for i, item in enumerate(not_items)
|
||||
})
|
||||
values = ', '.join(
|
||||
f':$not_{attr}{i}' for i in range(len(not_items))
|
||||
)
|
||||
if for_count:
|
||||
constraints[f'claim.claim_hash__not_in#_not_{attr}'] = f"""
|
||||
SELECT claim_hash FROM {attr} WHERE {attr} IN ({values})
|
||||
"""
|
||||
else:
|
||||
constraints[f'#_not_{attr}'] = f"""
|
||||
NOT EXISTS(
|
||||
SELECT 1 FROM {attr} WHERE
|
||||
claim.claim_hash={attr}.claim_hash
|
||||
AND {attr} IN ({values})
|
||||
)
|
||||
"""
|
||||
@@ -1,135 +0,0 @@
|
||||
import time
|
||||
import math
|
||||
from typing import Tuple
|
||||
|
||||
|
||||
def calculate_elapsed(start) -> int:
|
||||
return int((time.perf_counter() - start) * 1000)
|
||||
|
||||
|
||||
def calculate_avg_percentiles(data) -> Tuple[int, int, int, int, int, int, int, int]:
|
||||
if not data:
|
||||
return 0, 0, 0, 0, 0, 0, 0, 0
|
||||
data.sort()
|
||||
size = len(data)
|
||||
return (
|
||||
int(sum(data) / size),
|
||||
data[0],
|
||||
data[math.ceil(size * .05) - 1],
|
||||
data[math.ceil(size * .25) - 1],
|
||||
data[math.ceil(size * .50) - 1],
|
||||
data[math.ceil(size * .75) - 1],
|
||||
data[math.ceil(size * .95) - 1],
|
||||
data[-1]
|
||||
)
|
||||
|
||||
|
||||
def remove_select_list(sql) -> str:
|
||||
return sql[sql.index('FROM'):]
|
||||
|
||||
|
||||
class APICallMetrics:
|
||||
|
||||
def __init__(self, name):
|
||||
self.name = name
|
||||
|
||||
# total requests received
|
||||
self.receive_count = 0
|
||||
self.cache_response_count = 0
|
||||
|
||||
# millisecond timings for query based responses
|
||||
self.query_response_times = []
|
||||
self.query_intrp_times = []
|
||||
self.query_error_times = []
|
||||
|
||||
self.query_python_times = []
|
||||
self.query_wait_times = []
|
||||
self.query_sql_times = [] # aggregate total of multiple SQL calls made per request
|
||||
|
||||
self.individual_sql_times = [] # every SQL query run on server
|
||||
|
||||
# actual queries
|
||||
self.errored_queries = set()
|
||||
self.interrupted_queries = set()
|
||||
|
||||
def to_json_and_reset(self):
|
||||
return {
|
||||
# total requests received
|
||||
"receive_count": self.receive_count,
|
||||
# sum of these is total responses made
|
||||
"cache_response_count": self.cache_response_count,
|
||||
"query_response_count": len(self.query_response_times),
|
||||
"intrp_response_count": len(self.query_intrp_times),
|
||||
"error_response_count": len(self.query_error_times),
|
||||
# millisecond timings for non-cache responses
|
||||
"response": calculate_avg_percentiles(self.query_response_times),
|
||||
"interrupt": calculate_avg_percentiles(self.query_intrp_times),
|
||||
"error": calculate_avg_percentiles(self.query_error_times),
|
||||
# response, interrupt and error each also report the python, wait and sql stats:
|
||||
"python": calculate_avg_percentiles(self.query_python_times),
|
||||
"wait": calculate_avg_percentiles(self.query_wait_times),
|
||||
"sql": calculate_avg_percentiles(self.query_sql_times),
|
||||
# extended timings for individual sql executions
|
||||
"individual_sql": calculate_avg_percentiles(self.individual_sql_times),
|
||||
"individual_sql_count": len(self.individual_sql_times),
|
||||
# actual queries
|
||||
"errored_queries": list(self.errored_queries),
|
||||
"interrupted_queries": list(self.interrupted_queries),
|
||||
}
|
||||
|
||||
def start(self):
|
||||
self.receive_count += 1
|
||||
|
||||
def cache_response(self):
|
||||
self.cache_response_count += 1
|
||||
|
||||
def _add_query_timings(self, request_total_time, metrics):
|
||||
if metrics and 'execute_query' in metrics:
|
||||
sub_process_total = metrics[self.name][0]['total']
|
||||
individual_query_times = [f['total'] for f in metrics['execute_query']]
|
||||
aggregated_query_time = sum(individual_query_times)
|
||||
self.individual_sql_times.extend(individual_query_times)
|
||||
self.query_sql_times.append(aggregated_query_time)
|
||||
self.query_python_times.append(sub_process_total - aggregated_query_time)
|
||||
self.query_wait_times.append(request_total_time - sub_process_total)
|
||||
|
||||
@staticmethod
|
||||
def _add_queries(query_set, metrics):
|
||||
if metrics and 'execute_query' in metrics:
|
||||
for execute_query in metrics['execute_query']:
|
||||
if 'sql' in execute_query:
|
||||
query_set.add(remove_select_list(execute_query['sql']))
|
||||
|
||||
def query_response(self, start, metrics):
|
||||
self.query_response_times.append(calculate_elapsed(start))
|
||||
self._add_query_timings(self.query_response_times[-1], metrics)
|
||||
|
||||
def query_interrupt(self, start, metrics):
|
||||
self.query_intrp_times.append(calculate_elapsed(start))
|
||||
self._add_queries(self.interrupted_queries, metrics)
|
||||
self._add_query_timings(self.query_intrp_times[-1], metrics)
|
||||
|
||||
def query_error(self, start, metrics):
|
||||
self.query_error_times.append(calculate_elapsed(start))
|
||||
self._add_queries(self.errored_queries, metrics)
|
||||
self._add_query_timings(self.query_error_times[-1], metrics)
|
||||
|
||||
|
||||
class ServerLoadData:
|
||||
|
||||
def __init__(self):
|
||||
self._apis = {}
|
||||
|
||||
def for_api(self, name) -> APICallMetrics:
|
||||
if name not in self._apis:
|
||||
self._apis[name] = APICallMetrics(name)
|
||||
return self._apis[name]
|
||||
|
||||
def to_json_and_reset(self, status):
|
||||
try:
|
||||
return {
|
||||
'api': {name: api.to_json_and_reset() for name, api in self._apis.items()},
|
||||
'status': status
|
||||
}
|
||||
finally:
|
||||
self._apis = {}
|
||||
@@ -1,263 +0,0 @@
|
||||
import os
|
||||
import math
|
||||
import time
|
||||
import base64
|
||||
import asyncio
|
||||
from binascii import hexlify
|
||||
from pylru import lrucache
|
||||
from concurrent.futures import ProcessPoolExecutor, ThreadPoolExecutor
|
||||
|
||||
from torba.rpc.jsonrpc import RPCError, JSONRPC
|
||||
from torba.server.session import ElectrumX, SessionManager
|
||||
from torba.server import util
|
||||
|
||||
from lbry.wallet.server.block_processor import LBRYBlockProcessor
|
||||
from lbry.wallet.server.db.writer import LBRYDB
|
||||
from lbry.wallet.server.db import reader
|
||||
from lbry.wallet.server.websocket import AdminWebSocket
|
||||
from lbry.wallet.server.metrics import ServerLoadData, APICallMetrics
|
||||
|
||||
|
||||
class ResultCacheItem:
|
||||
__slots__ = '_result', 'lock', 'has_result'
|
||||
|
||||
def __init__(self):
|
||||
self.has_result = asyncio.Event()
|
||||
self.lock = asyncio.Lock()
|
||||
self._result = None
|
||||
|
||||
@property
|
||||
def result(self) -> str:
|
||||
return self._result
|
||||
|
||||
@result.setter
|
||||
def result(self, result: str):
|
||||
self._result = result
|
||||
if result is not None:
|
||||
self.has_result.set()
|
||||
|
||||
|
||||
class LBRYSessionManager(SessionManager):
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
self.query_executor = None
|
||||
self.websocket = None
|
||||
self.metrics = ServerLoadData()
|
||||
self.metrics_loop = None
|
||||
self.running = False
|
||||
if self.env.websocket_host is not None and self.env.websocket_port is not None:
|
||||
self.websocket = AdminWebSocket(self)
|
||||
self.search_cache = self.bp.search_cache
|
||||
self.search_cache['search'] = lrucache(10000)
|
||||
self.search_cache['resolve'] = lrucache(10000)
|
||||
|
||||
async def process_metrics(self):
|
||||
while self.running:
|
||||
data = self.metrics.to_json_and_reset({'sessions': self.session_count()})
|
||||
if self.websocket is not None:
|
||||
self.websocket.send_message(data)
|
||||
await asyncio.sleep(1)
|
||||
|
||||
async def start_other(self):
|
||||
self.running = True
|
||||
args = dict(
|
||||
initializer=reader.initializer,
|
||||
initargs=(self.logger, 'claims.db', 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:
|
||||
self.query_executor = ThreadPoolExecutor(max_workers=1, **args)
|
||||
else:
|
||||
self.query_executor = ProcessPoolExecutor(
|
||||
max_workers=self.env.max_query_workers or max(os.cpu_count(), 4), **args
|
||||
)
|
||||
if self.websocket is not None:
|
||||
await self.websocket.start()
|
||||
if self.env.track_metrics:
|
||||
self.metrics_loop = asyncio.create_task(self.process_metrics())
|
||||
|
||||
async def stop_other(self):
|
||||
self.running = False
|
||||
if self.env.track_metrics:
|
||||
self.metrics_loop.cancel()
|
||||
if self.websocket is not None:
|
||||
await self.websocket.stop()
|
||||
self.query_executor.shutdown()
|
||||
|
||||
|
||||
class LBRYElectrumX(ElectrumX):
|
||||
PROTOCOL_MIN = (0, 0) # temporary, for supporting 0.10 protocol
|
||||
max_errors = math.inf # don't disconnect people for errors! let them happen...
|
||||
session_mgr: LBRYSessionManager
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
# fixme: this is a rebase hack, we need to go through ChainState instead later
|
||||
self.daemon = self.session_mgr.daemon
|
||||
self.bp: LBRYBlockProcessor = self.session_mgr.bp
|
||||
self.db: LBRYDB = self.bp.db
|
||||
|
||||
def set_request_handlers(self, ptuple):
|
||||
super().set_request_handlers(ptuple)
|
||||
handlers = {
|
||||
'blockchain.transaction.get_height': self.transaction_get_height,
|
||||
'blockchain.claimtrie.search': self.claimtrie_search,
|
||||
'blockchain.claimtrie.resolve': self.claimtrie_resolve,
|
||||
'blockchain.claimtrie.getclaimsbyids': self.claimtrie_getclaimsbyids,
|
||||
'blockchain.block.get_server_height': self.get_server_height,
|
||||
}
|
||||
self.request_handlers.update(handlers)
|
||||
|
||||
async def run_in_executor(self, metrics: APICallMetrics, 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.query_interrupt(start, error.metrics)
|
||||
raise RPCError(JSONRPC.QUERY_TIMEOUT, 'sqlite query timed out')
|
||||
except reader.SQLiteOperationalError as error:
|
||||
metrics.query_error(start, error.metrics)
|
||||
raise RPCError(JSONRPC.INTERNAL_ERROR, 'query failed to execute')
|
||||
except:
|
||||
metrics.query_error(start, {})
|
||||
raise RPCError(JSONRPC.INTERNAL_ERROR, 'unknown server error')
|
||||
|
||||
if self.env.track_metrics:
|
||||
(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.start()
|
||||
cache = self.session_mgr.search_cache[query_name]
|
||||
cache_key = str(kwargs)
|
||||
cache_item = cache.get(cache_key)
|
||||
if cache_item is None:
|
||||
cache_item = cache[cache_key] = ResultCacheItem()
|
||||
elif cache_item.result is not None:
|
||||
metrics.cache_response()
|
||||
return cache_item.result
|
||||
async with cache_item.lock:
|
||||
if cache_item.result is None:
|
||||
cache_item.result = await self.run_in_executor(
|
||||
metrics, function, kwargs
|
||||
)
|
||||
else:
|
||||
metrics.cache_response()
|
||||
return cache_item.result
|
||||
|
||||
async def claimtrie_search(self, **kwargs):
|
||||
if kwargs:
|
||||
return await self.run_and_cache_query('search', reader.search_to_bytes, kwargs)
|
||||
|
||||
async def claimtrie_resolve(self, *urls):
|
||||
if urls:
|
||||
return await self.run_and_cache_query('resolve', reader.resolve_to_bytes, urls)
|
||||
|
||||
async def get_server_height(self):
|
||||
return self.bp.height
|
||||
|
||||
async def transaction_get_height(self, tx_hash):
|
||||
self.assert_tx_hash(tx_hash)
|
||||
transaction_info = await self.daemon.getrawtransaction(tx_hash, True)
|
||||
if transaction_info and 'hex' in transaction_info and 'confirmations' in transaction_info:
|
||||
# an unconfirmed transaction from lbrycrdd will not have a 'confirmations' field
|
||||
return (self.db.db_height - transaction_info['confirmations']) + 1
|
||||
elif transaction_info and 'hex' in transaction_info:
|
||||
return -1
|
||||
return None
|
||||
|
||||
async def claimtrie_getclaimsbyids(self, *claim_ids):
|
||||
claims = await self.batched_formatted_claims_from_daemon(claim_ids)
|
||||
return dict(zip(claim_ids, claims))
|
||||
|
||||
async def batched_formatted_claims_from_daemon(self, claim_ids):
|
||||
claims = await self.daemon.getclaimsbyids(claim_ids)
|
||||
result = []
|
||||
for claim in claims:
|
||||
if claim and claim.get('value'):
|
||||
result.append(self.format_claim_from_daemon(claim))
|
||||
return result
|
||||
|
||||
def format_claim_from_daemon(self, claim, name=None):
|
||||
"""Changes the returned claim data to the format expected by lbry and adds missing fields."""
|
||||
|
||||
if not claim:
|
||||
return {}
|
||||
|
||||
# this ISO-8859 nonsense stems from a nasty form of encoding extended characters in lbrycrd
|
||||
# it will be fixed after the lbrycrd upstream merge to v17 is done
|
||||
# it originated as a fear of terminals not supporting unicode. alas, they all do
|
||||
|
||||
if 'name' in claim:
|
||||
name = claim['name'].encode('ISO-8859-1').decode()
|
||||
info = self.db.sql.get_claims(claim_id=claim['claimId'])
|
||||
if not info:
|
||||
# raise RPCError("Lbrycrd has {} but not lbryumx, please submit a bug report.".format(claim_id))
|
||||
return {}
|
||||
address = info.address.decode()
|
||||
# fixme: temporary
|
||||
#supports = self.format_supports_from_daemon(claim.get('supports', []))
|
||||
supports = []
|
||||
|
||||
amount = get_from_possible_keys(claim, 'amount', 'nAmount')
|
||||
height = get_from_possible_keys(claim, 'height', 'nHeight')
|
||||
effective_amount = get_from_possible_keys(claim, 'effective amount', 'nEffectiveAmount')
|
||||
valid_at_height = get_from_possible_keys(claim, 'valid at height', 'nValidAtHeight')
|
||||
|
||||
result = {
|
||||
"name": name,
|
||||
"claim_id": claim['claimId'],
|
||||
"txid": claim['txid'],
|
||||
"nout": claim['n'],
|
||||
"amount": amount,
|
||||
"depth": self.db.db_height - height + 1,
|
||||
"height": height,
|
||||
"value": hexlify(claim['value'].encode('ISO-8859-1')).decode(),
|
||||
"address": address, # from index
|
||||
"supports": supports,
|
||||
"effective_amount": effective_amount,
|
||||
"valid_at_height": valid_at_height
|
||||
}
|
||||
if 'claim_sequence' in claim:
|
||||
# TODO: ensure that lbrycrd #209 fills in this value
|
||||
result['claim_sequence'] = claim['claim_sequence']
|
||||
else:
|
||||
result['claim_sequence'] = -1
|
||||
if 'normalized_name' in claim:
|
||||
result['normalized_name'] = claim['normalized_name'].encode('ISO-8859-1').decode()
|
||||
return result
|
||||
|
||||
def assert_tx_hash(self, value):
|
||||
'''Raise an RPCError if the value is not a valid transaction
|
||||
hash.'''
|
||||
try:
|
||||
if len(util.hex_to_bytes(value)) == 32:
|
||||
return
|
||||
except Exception:
|
||||
pass
|
||||
raise RPCError(1, f'{value} should be a transaction hash')
|
||||
|
||||
def assert_claim_id(self, value):
|
||||
'''Raise an RPCError if the value is not a valid claim id
|
||||
hash.'''
|
||||
try:
|
||||
if len(util.hex_to_bytes(value)) == 20:
|
||||
return
|
||||
except Exception:
|
||||
pass
|
||||
raise RPCError(1, f'{value} should be a claim id hash')
|
||||
|
||||
|
||||
def get_from_possible_keys(dictionary, *keys):
|
||||
for key in keys:
|
||||
if key in dictionary:
|
||||
return dictionary[key]
|
||||
@@ -1,55 +0,0 @@
|
||||
import asyncio
|
||||
from weakref import WeakSet
|
||||
|
||||
from aiohttp.web import Application, AppRunner, WebSocketResponse, TCPSite
|
||||
from aiohttp.http_websocket import WSMsgType, WSCloseCode
|
||||
|
||||
|
||||
class AdminWebSocket:
|
||||
|
||||
def __init__(self, manager):
|
||||
self.manager = manager
|
||||
self.app = Application()
|
||||
self.app['websockets'] = WeakSet()
|
||||
self.app.router.add_get('/', self.on_connect)
|
||||
self.app.on_shutdown.append(self.on_shutdown)
|
||||
self.runner = AppRunner(self.app)
|
||||
|
||||
async def on_status(self, _):
|
||||
if not self.app['websockets']:
|
||||
return
|
||||
self.send_message({
|
||||
'type': 'status',
|
||||
'height': self.manager.daemon.cached_height(),
|
||||
})
|
||||
|
||||
def send_message(self, msg):
|
||||
for web_socket in self.app['websockets']:
|
||||
asyncio.create_task(web_socket.send_json(msg))
|
||||
|
||||
async def start(self):
|
||||
await self.runner.setup()
|
||||
await TCPSite(self.runner, self.manager.env.websocket_host, self.manager.env.websocket_port).start()
|
||||
|
||||
async def stop(self):
|
||||
await self.runner.cleanup()
|
||||
|
||||
async def on_connect(self, request):
|
||||
web_socket = WebSocketResponse()
|
||||
await web_socket.prepare(request)
|
||||
self.app['websockets'].add(web_socket)
|
||||
try:
|
||||
async for msg in web_socket:
|
||||
if msg.type == WSMsgType.TEXT:
|
||||
await self.on_status(None)
|
||||
elif msg.type == WSMsgType.ERROR:
|
||||
print('web socket connection closed with exception %s' %
|
||||
web_socket.exception())
|
||||
finally:
|
||||
self.app['websockets'].discard(web_socket)
|
||||
return web_socket
|
||||
|
||||
@staticmethod
|
||||
async def on_shutdown(app):
|
||||
for web_socket in set(app['websockets']):
|
||||
await web_socket.close(code=WSCloseCode.GOING_AWAY, message='Server shutdown')
|
||||
@@ -1,32 +0,0 @@
|
||||
import argparse
|
||||
import sqlite3
|
||||
from binascii import hexlify
|
||||
from lbry.wallet.transaction import Output
|
||||
|
||||
|
||||
def check(db_path, claim_id):
|
||||
db = sqlite3.connect(db_path)
|
||||
db.row_factory = sqlite3.Row
|
||||
claim = db.execute('select * from claim where claim_id=?', (claim_id,)).fetchone()
|
||||
if not claim:
|
||||
print('Could not find claim.')
|
||||
return
|
||||
channel = db.execute('select * from claim where claim_hash=?', (claim['channel_hash'],)).fetchone()
|
||||
if not channel:
|
||||
print('Could not find channel for this claim.')
|
||||
print(f"Claim: {claim['claim_name']}")
|
||||
print(f"Channel: {channel['claim_name']}")
|
||||
print(f"Signature: {hexlify(claim['signature']).decode()}")
|
||||
print(f"Digest: {hexlify(claim['signature_digest']).decode()}")
|
||||
print(f"Pubkey: {hexlify(channel['public_key_bytes']).decode()}")
|
||||
print("Valid: {}".format(Output.is_signature_valid(
|
||||
claim['signature'], claim['signature_digest'], channel['public_key_bytes']
|
||||
)))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('db_path')
|
||||
parser.add_argument('claim_id')
|
||||
args = parser.parse_args()
|
||||
check(args.db_path, args.claim_id)
|
||||
@@ -1,177 +0,0 @@
|
||||
import os
|
||||
import time
|
||||
import textwrap
|
||||
import argparse
|
||||
import asyncio
|
||||
import logging
|
||||
from concurrent.futures.process import ProcessPoolExecutor
|
||||
from lbry.wallet.server.db.reader import search_to_bytes, initializer, _get_claims, interpolate
|
||||
from lbry.wallet.ledger import MainNetLedger
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
log.addHandler(logging.StreamHandler())
|
||||
log.setLevel(logging.CRITICAL)
|
||||
|
||||
DEFAULT_ANY_TAGS = [
|
||||
'blockchain',
|
||||
'news',
|
||||
'learning',
|
||||
'technology',
|
||||
'automotive',
|
||||
'economics',
|
||||
'food',
|
||||
'science',
|
||||
'art',
|
||||
'nature'
|
||||
]
|
||||
|
||||
COMMON_AND_RARE = [
|
||||
'gaming',
|
||||
'ufos'
|
||||
]
|
||||
|
||||
COMMON_AND_RARE2 = [
|
||||
'city fix',
|
||||
'gaming'
|
||||
]
|
||||
|
||||
RARE_ANY_TAGS = [
|
||||
'city fix',
|
||||
'ufos',
|
||||
]
|
||||
|
||||
CITY_FIX = [
|
||||
'city fix'
|
||||
]
|
||||
|
||||
MATURE_TAGS = [
|
||||
'porn',
|
||||
'nsfw',
|
||||
'mature',
|
||||
'xxx'
|
||||
]
|
||||
|
||||
ORDER_BY = [
|
||||
[
|
||||
"trending_global",
|
||||
"trending_mixed",
|
||||
],
|
||||
[
|
||||
"release_time"
|
||||
],
|
||||
[
|
||||
"effective_amount"
|
||||
]
|
||||
]
|
||||
|
||||
|
||||
def get_args(limit=20):
|
||||
args = []
|
||||
any_tags_combinations = [DEFAULT_ANY_TAGS, COMMON_AND_RARE, RARE_ANY_TAGS, COMMON_AND_RARE2, CITY_FIX, []]
|
||||
not_tags_combinations = [MATURE_TAGS, []]
|
||||
for no_fee in [False, True]:
|
||||
for claim_type in [None, 'stream', 'channel']:
|
||||
for no_totals in [True]:
|
||||
for offset in [0, 100]:
|
||||
for any_tags in any_tags_combinations:
|
||||
for not_tags in not_tags_combinations:
|
||||
for order_by in ORDER_BY:
|
||||
kw = {
|
||||
'order_by': order_by,
|
||||
'offset': offset,
|
||||
'limit': limit,
|
||||
'no_totals': no_totals
|
||||
}
|
||||
if not_tags:
|
||||
kw['not_tags'] = not_tags
|
||||
if any_tags:
|
||||
kw['any_tags'] = any_tags
|
||||
if claim_type:
|
||||
kw['claim_type'] = claim_type
|
||||
if no_fee:
|
||||
kw['fee_amount'] = 0
|
||||
args.append(kw)
|
||||
print(f"-- Trying {len(args)} argument combinations")
|
||||
return args
|
||||
|
||||
|
||||
def _search(kwargs):
|
||||
start = time.perf_counter()
|
||||
error = None
|
||||
try:
|
||||
search_to_bytes(kwargs)
|
||||
except Exception as err:
|
||||
error = str(err)
|
||||
return time.perf_counter() - start, kwargs, error
|
||||
|
||||
|
||||
async def search(executor, kwargs):
|
||||
return await asyncio.get_running_loop().run_in_executor(
|
||||
executor, _search, kwargs
|
||||
)
|
||||
|
||||
|
||||
async def main(db_path, max_query_time):
|
||||
args = dict(initializer=initializer, initargs=(log, db_path, MainNetLedger, 0.25))
|
||||
workers = max(os.cpu_count(), 4)
|
||||
log.info(f"using {workers} reader processes")
|
||||
query_executor = ProcessPoolExecutor(workers, **args)
|
||||
tasks = [search(query_executor, constraints) for constraints in get_args()]
|
||||
try:
|
||||
results = await asyncio.gather(*tasks)
|
||||
query_times = [
|
||||
{
|
||||
'sql': interpolate(*_get_claims("""
|
||||
claimtrie.claim_hash as is_controlling,
|
||||
claimtrie.last_take_over_height,
|
||||
claim.claim_hash, claim.txo_hash,
|
||||
claim.claims_in_channel,
|
||||
claim.height, claim.creation_height,
|
||||
claim.activation_height, claim.expiration_height,
|
||||
claim.effective_amount, claim.support_amount,
|
||||
claim.trending_group, claim.trending_mixed,
|
||||
claim.trending_local, claim.trending_global,
|
||||
claim.short_url, claim.canonical_url,
|
||||
claim.channel_hash, channel.txo_hash AS channel_txo_hash,
|
||||
channel.height AS channel_height, claim.signature_valid
|
||||
""", **constraints)),
|
||||
'duration': ts,
|
||||
'error': error
|
||||
}
|
||||
for ts, constraints, error in results
|
||||
]
|
||||
errored = [query_info for query_info in query_times if query_info['error']]
|
||||
errors = {str(query_info['error']): [] for query_info in errored}
|
||||
for error in errored:
|
||||
errors[str(error['error'])].append(error['sql'])
|
||||
slow = [
|
||||
query_info for query_info in query_times
|
||||
if not query_info['error'] and query_info['duration'] > (max_query_time / 2.0)
|
||||
]
|
||||
fast = [
|
||||
query_info for query_info in query_times
|
||||
if not query_info['error'] and query_info['duration'] <= (max_query_time / 2.0)
|
||||
]
|
||||
print(f"-- {len(fast)} queries were fast")
|
||||
slow.sort(key=lambda query_info: query_info['duration'], reverse=True)
|
||||
print(f"-- Failing queries:")
|
||||
for error in errors:
|
||||
print(f"-- Failure: \"{error}\"")
|
||||
for failing_query in errors[error]:
|
||||
print(f"{textwrap.dedent(failing_query)};\n")
|
||||
print()
|
||||
print(f"-- Slow queries:")
|
||||
for slow_query in slow:
|
||||
print(f"-- Query took {slow_query['duration']}\n{textwrap.dedent(slow_query['sql'])};\n")
|
||||
finally:
|
||||
query_executor.shutdown()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('--db_path', dest='db_path', default=os.path.expanduser('~/claims.db'), type=str)
|
||||
parser.add_argument('--max_time', dest='max_time', default=0.25, type=float)
|
||||
args = parser.parse_args()
|
||||
db_path = args.db_path
|
||||
max_query_time = args.max_time
|
||||
asyncio.run(main(db_path, max_query_time))
|
||||
@@ -1,107 +0,0 @@
|
||||
import time
|
||||
import asyncio
|
||||
import random
|
||||
from argparse import ArgumentParser
|
||||
from torba.client.basenetwork import ClientSession
|
||||
|
||||
|
||||
class AgentSmith(ClientSession):
|
||||
|
||||
async def do_nefarious_things(self):
|
||||
await self.send_request('blockchain.claimtrie.search', {
|
||||
'no_totals': True,
|
||||
'offset': random.choice(range(0, 300, 20)),
|
||||
'limit': 20,
|
||||
'any_tags': (
|
||||
random.choice([[
|
||||
random.choice(['gaming', 'games', 'game']) +
|
||||
random.choice(['entertainment', 'playthrough', 'funny']) +
|
||||
random.choice(['xbox', 'xbox one', 'xbox news'])
|
||||
], [
|
||||
random.choice(['aliens', 'alien', 'ufo', 'ufos']) +
|
||||
random.choice(['news', 'sighting', 'sightings'])
|
||||
], [
|
||||
random.choice(['art', 'automotive']),
|
||||
random.choice(['blockchain', 'economics', 'food']),
|
||||
random.choice(['funny', 'learnings', 'nature']),
|
||||
random.choice(['news', 'science', 'technology'])
|
||||
]
|
||||
])
|
||||
),
|
||||
'not_tags': random.choice([[], [
|
||||
'porn', 'mature', 'xxx', 'nsfw'
|
||||
]]),
|
||||
'order_by': random.choice([
|
||||
['release_time'],
|
||||
['trending_global', 'trending_mixed'],
|
||||
['effective_amount']
|
||||
])
|
||||
})
|
||||
|
||||
|
||||
class AgentSmithProgram:
|
||||
|
||||
def __init__(self, host, port):
|
||||
self.host, self.port = host, port
|
||||
self.agent_smiths = []
|
||||
|
||||
async def make_one_more_of_them(self):
|
||||
smith = AgentSmith(network=None, server=(self.host, self.port))
|
||||
await smith.create_connection()
|
||||
self.agent_smiths.append(smith)
|
||||
|
||||
async def coordinate_nefarious_activity(self):
|
||||
start = time.perf_counter()
|
||||
await asyncio.gather(
|
||||
*(s.do_nefarious_things() for s in self.agent_smiths),
|
||||
return_exceptions=True
|
||||
)
|
||||
return time.perf_counter() - start
|
||||
|
||||
def __len__(self):
|
||||
return len(self.agent_smiths)
|
||||
|
||||
async def delete_one_smith(self):
|
||||
if self.agent_smiths:
|
||||
await self.agent_smiths.pop().close()
|
||||
|
||||
async def delete_program(self):
|
||||
await asyncio.gather(*(
|
||||
s.close() for s in self.agent_smiths
|
||||
))
|
||||
|
||||
|
||||
async def main(host, port):
|
||||
smiths = AgentSmithProgram(host, port)
|
||||
await smiths.make_one_more_of_them()
|
||||
activity = asyncio.create_task(smiths.coordinate_nefarious_activity())
|
||||
ease_off = 0
|
||||
for i in range(1000):
|
||||
await asyncio.sleep(1)
|
||||
if activity.done() and activity.result() < .9:
|
||||
print('more, more, more...')
|
||||
await asyncio.gather(*(
|
||||
asyncio.create_task(smiths.make_one_more_of_them()) for _ in range(20)
|
||||
))
|
||||
else:
|
||||
print('!!!!!!!!!!!!!!')
|
||||
print('IS NEO LOSING?')
|
||||
print('!!!!!!!!!!!!!!')
|
||||
await asyncio.gather(*(
|
||||
asyncio.create_task(smiths.delete_one_smith()) for _ in range(21)
|
||||
))
|
||||
print(f'coordinate all {len(smiths)} smiths to action')
|
||||
activity = asyncio.create_task(smiths.coordinate_nefarious_activity())
|
||||
print('finishing up any remaining actions')
|
||||
await activity
|
||||
print('neo has won, deleting agents...')
|
||||
await smiths.delete_program()
|
||||
print('done.')
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
parser = ArgumentParser()
|
||||
parser.add_argument('--host', dest='host', default='localhost', type=str)
|
||||
parser.add_argument('--port', dest='port', default=50001, type=int)
|
||||
args = parser.parse_args()
|
||||
asyncio.run(main(args.host, args.port))
|
||||
@@ -1,17 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="PYTHON_MODULE" version="4">
|
||||
<component name="NewModuleRootManager">
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/torba" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/torba/tests" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/lbry" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/lbry/tests" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/lbry/scripts" isTestSource="false" />
|
||||
</content>
|
||||
<orderEntry type="jdk" jdkName="Python 3.7 (lbry)" jdkType="Python SDK" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
<component name="TestRunnerService">
|
||||
<option name="PROJECT_TEST_RUNNER" value="Unittests" />
|
||||
</component>
|
||||
</module>
|
||||
@@ -1,8 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/lbry-sdk.iml" filepath="$PROJECT_DIR$/.idea/lbry-sdk.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
||||
@@ -1,6 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
||||
@@ -1,49 +0,0 @@
|
||||
import os, asyncio, aiohttp, json, slack, sqlparse
|
||||
|
||||
|
||||
async def listen(slack_client, url):
|
||||
async with aiohttp.ClientSession(timeout=aiohttp.ClientTimeout(3)) as session:
|
||||
print(f"connecting to {url}")
|
||||
try:
|
||||
ws = await session.ws_connect(url)
|
||||
except (aiohttp.ClientConnectorError, asyncio.TimeoutError):
|
||||
print(f"failed to connect to {url}")
|
||||
return
|
||||
print(f"connected to {url}")
|
||||
|
||||
async for msg in ws:
|
||||
r = json.loads(msg.data)
|
||||
try:
|
||||
queries = r["api"]["search"]["interrupted_queries"]
|
||||
except KeyError:
|
||||
continue
|
||||
|
||||
for q in queries:
|
||||
# clean = re.sub(r"\s+", " ", q)
|
||||
clean = sqlparse.format(q, reindent=True, keyword_case='upper')
|
||||
print(f'{url}: {clean}')
|
||||
response = await slack_client.chat_postMessage(
|
||||
username=url,
|
||||
icon_emoji=":hourglass_flowing_sand:",
|
||||
channel='#clubhouse-de-obscure',
|
||||
text="*Query timed out:* " + clean
|
||||
)
|
||||
if not response["ok"]:
|
||||
print("SLACK ERROR:\n", response)
|
||||
print()
|
||||
|
||||
|
||||
async def main():
|
||||
try:
|
||||
slack_client = slack.WebClient(token=os.environ['SLACK_TOKEN'], run_async=True)
|
||||
except KeyError:
|
||||
print("Error: SLACK_TOKEN env var required")
|
||||
return
|
||||
|
||||
num_servers = 5
|
||||
tasks = []
|
||||
for i in range(1, num_servers+1):
|
||||
tasks.append(asyncio.create_task(listen(slack_client, f'http://spv{i}.lbry.com:50005')))
|
||||
await asyncio.gather(*tasks)
|
||||
|
||||
asyncio.run(main())
|
||||
@@ -1,62 +0,0 @@
|
||||
import uvloop, asyncio, time, sys, logging
|
||||
from concurrent.futures import ProcessPoolExecutor
|
||||
from lbry.wallet.server.db import reader
|
||||
from lbry.wallet.server.metrics import calculate_avg_percentiles
|
||||
|
||||
|
||||
db_path = '../../../lbryconf/wallet-server/claims.db'
|
||||
default_query_timout = 0.25
|
||||
log = logging.getLogger(__name__)
|
||||
log.addHandler(logging.StreamHandler())
|
||||
|
||||
|
||||
async def run_times(executor, iterations, show=True):
|
||||
start = time.perf_counter()
|
||||
timings = await asyncio.gather(*(asyncio.get_running_loop().run_in_executor(
|
||||
executor, reader.search_to_bytes, {
|
||||
'no_totals': True,
|
||||
'offset': 0,
|
||||
'limit': 20,
|
||||
'any_tags': [
|
||||
'ufos', 'city fix'
|
||||
],
|
||||
'not_tags': [
|
||||
'porn', 'mature', 'xxx', 'nsfw'
|
||||
],
|
||||
'order_by': [
|
||||
'release_time'
|
||||
]
|
||||
}
|
||||
) for _ in range(iterations)))
|
||||
timings = [r[1]['execute_query'][0]['total'] for r in timings]
|
||||
total = int((time.perf_counter() - start) * 100)
|
||||
if show:
|
||||
avg = sum(timings)/len(timings)
|
||||
print(f"{iterations:4}: {total}ms total concurrent, {len(timings)*avg*1000:.3f}s total sequential (avg*runs)")
|
||||
print(f" {total/len(timings):.1f}ms/query concurrent (total/runs)")
|
||||
print(f" {avg:.1f}ms/query actual average (sum(queries)/runs)")
|
||||
stats = calculate_avg_percentiles(timings)
|
||||
print(f" min: {stats[1]}, 5%: {stats[2]}, 25%: {stats[3]}, 50%: {stats[4]}, 75%: {stats[5]}, 95%: {stats[6]}, max: {stats[7]}")
|
||||
sys.stdout.write(' sample:')
|
||||
for i, t in zip(range(10), timings[::-1]):
|
||||
sys.stdout.write(f' {t}ms')
|
||||
print(' ...\n' if len(timings) > 10 else '\n')
|
||||
|
||||
|
||||
async def main():
|
||||
executor = ProcessPoolExecutor(
|
||||
4, initializer=reader.initializer, initargs=(log, db_path, 'mainnet', 1.0, True)
|
||||
)
|
||||
#await run_times(executor, 4, show=False)
|
||||
#await run_times(executor, 1)
|
||||
await run_times(executor, 2**3)
|
||||
await run_times(executor, 2**5)
|
||||
await run_times(executor, 2**7)
|
||||
#await run_times(executor, 2**9)
|
||||
#await run_times(executor, 2**11)
|
||||
#await run_times(executor, 2**13)
|
||||
executor.shutdown(True)
|
||||
|
||||
if __name__ == '__main__':
|
||||
uvloop.install()
|
||||
asyncio.run(main())
|
||||
@@ -1,160 +0,0 @@
|
||||
import os
|
||||
import sys
|
||||
import json
|
||||
import argparse
|
||||
import asyncio
|
||||
import time
|
||||
|
||||
import aiohttp
|
||||
from aiohttp import ClientConnectorError
|
||||
from lbry import __version__
|
||||
from lbry.blob.blob_file import MAX_BLOB_SIZE
|
||||
from lbry.conf import Config
|
||||
from lbry.extras.daemon.client import daemon_rpc
|
||||
from lbry.extras import system_info
|
||||
|
||||
|
||||
async def report_to_slack(output, webhook):
|
||||
payload = {
|
||||
"text": f"lbrynet {__version__} ({system_info.get_platform()['platform']}) time to first byte:\n{output}"
|
||||
}
|
||||
async with aiohttp.request('post', webhook, data=json.dumps(payload)):
|
||||
pass
|
||||
|
||||
|
||||
def confidence(times, z, plus_err=True):
|
||||
mean = sum(times) / len(times)
|
||||
standard_dev = (sum(((t - sum(times) / len(times)) ** 2.0 for t in times)) / len(times)) ** 0.5
|
||||
err = (z * standard_dev) / (len(times) ** 0.5)
|
||||
return f"{round((mean + err) if plus_err else (mean - err), 3)}"
|
||||
|
||||
|
||||
def variance(times):
|
||||
mean = sum(times) / len(times)
|
||||
return round(sum(((i - mean) ** 2.0 for i in times)) / (len(times) - 1), 3)
|
||||
|
||||
|
||||
async def wait_for_done(conf, claim_name, timeout):
|
||||
blobs_completed, last_completed = 0, time.perf_counter()
|
||||
while True:
|
||||
file = (await daemon_rpc(conf, "file_list", claim_name=claim_name))[0]
|
||||
if file['status'] in ['finished', 'stopped']:
|
||||
return True, file['blobs_completed'], file['blobs_in_stream']
|
||||
elif blobs_completed < int(file['blobs_completed']):
|
||||
blobs_completed, last_completed = int(file['blobs_completed']), time.perf_counter()
|
||||
elif (time.perf_counter() - last_completed) > timeout:
|
||||
return False, file['blobs_completed'], file['blobs_in_stream']
|
||||
await asyncio.sleep(1.0)
|
||||
|
||||
|
||||
async def main(cmd_args=None):
|
||||
print('Time to first byte started using parameters:')
|
||||
for key, value in vars(cmd_args).items():
|
||||
print(f"{key}: {value}")
|
||||
conf = Config()
|
||||
url_to_claim = {}
|
||||
try:
|
||||
for page in range(1, cmd_args.download_pages + 1):
|
||||
start = time.perf_counter()
|
||||
kwargs = {
|
||||
'page': page,
|
||||
# 'claim_type': 'stream',
|
||||
'order_by': ['trending_global', 'trending_mixed'],
|
||||
'no_totals': True
|
||||
}
|
||||
|
||||
# if not cmd_args.allow_fees:
|
||||
# kwargs['fee_amount'] = 0
|
||||
|
||||
response = await daemon_rpc(
|
||||
conf, 'claim_search', **kwargs
|
||||
)
|
||||
if 'error' in response or not response.get('items'):
|
||||
print(f'Error getting claim list page {page}:')
|
||||
print(response)
|
||||
return 1
|
||||
else:
|
||||
url_to_claim.update({
|
||||
claim['permanent_url']: claim for claim in response['items']
|
||||
})
|
||||
print(f'Claim search page {page} took: {time.perf_counter() - start}')
|
||||
except (ClientConnectorError, ConnectionError):
|
||||
print("Could not connect to daemon")
|
||||
return 1
|
||||
print("**********************************************")
|
||||
print(f"Attempting to download {len(url_to_claim)} claim_search streams")
|
||||
|
||||
first_byte_times = []
|
||||
download_speeds = []
|
||||
download_successes = []
|
||||
failed_to = {}
|
||||
|
||||
await asyncio.gather(*(
|
||||
daemon_rpc(conf, 'file_delete', delete_from_download_dir=True, claim_name=claim['name'])
|
||||
for claim in url_to_claim.values() if not cmd_args.keep_files
|
||||
))
|
||||
|
||||
for i, (url, claim) in enumerate(url_to_claim.items()):
|
||||
start = time.perf_counter()
|
||||
response = await daemon_rpc(conf, 'get', uri=url, save_file=not cmd_args.head_blob_only)
|
||||
if 'error' in response:
|
||||
print(f"{i + 1}/{len(url_to_claim)} - failed to start {url}: {response['error']}")
|
||||
failed_to[url] = 'start'
|
||||
if cmd_args.exit_on_error:
|
||||
return
|
||||
continue
|
||||
first_byte = time.perf_counter()
|
||||
first_byte_times.append(first_byte - start)
|
||||
print(f"{i + 1}/{len(url_to_claim)} - {first_byte - start} {url}")
|
||||
if not cmd_args.head_blob_only:
|
||||
downloaded, amount_downloaded, blobs_in_stream = await wait_for_done(
|
||||
conf, claim['name'], cmd_args.stall_download_timeout
|
||||
)
|
||||
if downloaded:
|
||||
download_successes.append(url)
|
||||
else:
|
||||
failed_to[url] = 'finish'
|
||||
mbs = round((blobs_in_stream * (MAX_BLOB_SIZE - 1)) / (time.perf_counter() - start) / 1000000, 2)
|
||||
download_speeds.append(mbs)
|
||||
print(f"downloaded {amount_downloaded}/{blobs_in_stream} blobs for {url} at "
|
||||
f"{mbs}mb/s")
|
||||
if not cmd_args.keep_files:
|
||||
await daemon_rpc(conf, 'file_delete', delete_from_download_dir=True, claim_name=claim['name'])
|
||||
await asyncio.sleep(0.1)
|
||||
|
||||
print("**********************************************")
|
||||
result = f"Started {len(first_byte_times)} of {len(url_to_claim)} attempted front page streams\n"
|
||||
if first_byte_times:
|
||||
result += f"Worst first byte time: {round(max(first_byte_times), 2)}\n" \
|
||||
f"Best first byte time: {round(min(first_byte_times), 2)}\n" \
|
||||
f"95% confidence time-to-first-byte: {confidence(first_byte_times, 1.984)}s\n" \
|
||||
f"99% confidence time-to-first-byte: {confidence(first_byte_times, 2.626)}s\n" \
|
||||
f"Variance: {variance(first_byte_times)}\n"
|
||||
if download_successes:
|
||||
result += f"Downloaded {len(download_successes)}/{len(url_to_claim)}\n" \
|
||||
f"Best stream download speed: {round(max(download_speeds), 2)}mb/s\n" \
|
||||
f"Worst stream download speed: {round(min(download_speeds), 2)}mb/s\n" \
|
||||
f"95% confidence download speed: {confidence(download_speeds, 1.984, False)}mb/s\n" \
|
||||
f"99% confidence download speed: {confidence(download_speeds, 2.626, False)}mb/s\n"
|
||||
|
||||
for reason in ('start', 'finish'):
|
||||
failures = [url for url, why in failed_to.items() if reason == why]
|
||||
if failures:
|
||||
result += f"\nFailed to {reason}:\n" + "\n".join(failures)
|
||||
print(result)
|
||||
|
||||
webhook = os.environ.get('TTFB_SLACK_TOKEN', None)
|
||||
if webhook:
|
||||
await report_to_slack(result, webhook)
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument("--allow_fees", action='store_true')
|
||||
parser.add_argument("--exit_on_error", action='store_true')
|
||||
parser.add_argument("--stall_download_timeout", default=0, type=int)
|
||||
parser.add_argument("--keep_files", action='store_true')
|
||||
parser.add_argument("--head_blob_only", action='store_true')
|
||||
parser.add_argument("--download_pages", type=int, default=10)
|
||||
sys.exit(asyncio.run(main(cmd_args=parser.parse_args())) or 0)
|
||||
@@ -1,216 +0,0 @@
|
||||
import sys
|
||||
import json
|
||||
import asyncio
|
||||
import argparse
|
||||
from datetime import datetime
|
||||
|
||||
try:
|
||||
import aiohttp
|
||||
import psycopg2
|
||||
except ImportError:
|
||||
print(f"To run {sys.argv[0]} you need to install aiohttp and psycopg2:")
|
||||
print(f"")
|
||||
print(f" $ pip install aiohttp psycopg2")
|
||||
print("")
|
||||
sys.exit(1)
|
||||
|
||||
if not sys.version_info >= (3, 7):
|
||||
print("Please use Python 3.7 or higher, this script expects that dictionary keys preserve order.")
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
async def monitor(db, server):
|
||||
c = db.cursor()
|
||||
async with aiohttp.ClientSession(timeout=aiohttp.ClientTimeout(10)) as session:
|
||||
try:
|
||||
ws = await session.ws_connect(server)
|
||||
except (aiohttp.ClientConnectorError, asyncio.TimeoutError):
|
||||
print(f"failed connecting to {server}")
|
||||
return
|
||||
print(f"connected to {server}")
|
||||
|
||||
async for msg in ws:
|
||||
r = json.loads(msg.data)
|
||||
|
||||
c.execute("""
|
||||
INSERT INTO wallet_server_stats (server, sessions, event_time) VALUES (%s,%s,%s);
|
||||
""", (server, r['status']['sessions'], datetime.now()))
|
||||
|
||||
for command, stats in r["api"].items():
|
||||
data = {
|
||||
'server': server,
|
||||
'command': command,
|
||||
'event_time': datetime.now()
|
||||
}
|
||||
for key, value in stats.items():
|
||||
if key.endswith("_queries"):
|
||||
continue
|
||||
if isinstance(value, list):
|
||||
data.update({
|
||||
key+'_avg': value[0],
|
||||
key+'_min': value[1],
|
||||
key+'_five': value[2],
|
||||
key+'_twenty_five': value[3],
|
||||
key+'_fifty': value[4],
|
||||
key+'_seventy_five': value[5],
|
||||
key+'_ninety_five': value[6],
|
||||
key+'_max': value[7],
|
||||
})
|
||||
else:
|
||||
data[key] = value
|
||||
|
||||
c.execute(f"""
|
||||
INSERT INTO wallet_server_command_stats ({','.join(data)})
|
||||
VALUES ({','.join('%s' for _ in data)});
|
||||
""", list(data.values()))
|
||||
|
||||
db.commit()
|
||||
|
||||
|
||||
async def main(dsn, servers):
|
||||
db = ensure_database(dsn)
|
||||
await asyncio.gather(*(
|
||||
asyncio.create_task(monitor(db, server))
|
||||
for server in servers
|
||||
))
|
||||
|
||||
|
||||
def ensure_database(dsn):
|
||||
db = psycopg2.connect(**dsn)
|
||||
c = db.cursor()
|
||||
c.execute("SELECT to_regclass('wallet_server_stats');")
|
||||
if c.fetchone()[0] is None:
|
||||
print("creating table 'wallet_server_stats'...")
|
||||
c.execute("""
|
||||
CREATE TABLE wallet_server_stats (
|
||||
server text,
|
||||
sessions integer,
|
||||
event_time timestamp
|
||||
);
|
||||
""")
|
||||
print("creating table 'wallet_server_command_stats'...")
|
||||
c.execute("""
|
||||
CREATE TABLE wallet_server_command_stats (
|
||||
server text,
|
||||
command text,
|
||||
event_time timestamp,
|
||||
|
||||
-- total requests received during event window
|
||||
receive_count integer,
|
||||
|
||||
-- sum of these is total responses made
|
||||
cache_response_count integer,
|
||||
query_response_count integer,
|
||||
intrp_response_count integer,
|
||||
error_response_count integer,
|
||||
|
||||
-- millisecond timings for non-cache responses (response_*, interrupt_*, error_*)
|
||||
|
||||
response_avg float,
|
||||
response_min float,
|
||||
response_five float,
|
||||
response_twenty_five float,
|
||||
response_fifty float,
|
||||
response_seventy_five float,
|
||||
response_ninety_five float,
|
||||
response_max float,
|
||||
|
||||
interrupt_avg float,
|
||||
interrupt_min float,
|
||||
interrupt_five float,
|
||||
interrupt_twenty_five float,
|
||||
interrupt_fifty float,
|
||||
interrupt_seventy_five float,
|
||||
interrupt_ninety_five float,
|
||||
interrupt_max float,
|
||||
|
||||
error_avg float,
|
||||
error_min float,
|
||||
error_five float,
|
||||
error_twenty_five float,
|
||||
error_fifty float,
|
||||
error_seventy_five float,
|
||||
error_ninety_five float,
|
||||
error_max float,
|
||||
|
||||
-- response, interrupt and error each also report the python, wait and sql stats
|
||||
|
||||
python_avg float,
|
||||
python_min float,
|
||||
python_five float,
|
||||
python_twenty_five float,
|
||||
python_fifty float,
|
||||
python_seventy_five float,
|
||||
python_ninety_five float,
|
||||
python_max float,
|
||||
|
||||
wait_avg float,
|
||||
wait_min float,
|
||||
wait_five float,
|
||||
wait_twenty_five float,
|
||||
wait_fifty float,
|
||||
wait_seventy_five float,
|
||||
wait_ninety_five float,
|
||||
wait_max float,
|
||||
|
||||
sql_avg float,
|
||||
sql_min float,
|
||||
sql_five float,
|
||||
sql_twenty_five float,
|
||||
sql_fifty float,
|
||||
sql_seventy_five float,
|
||||
sql_ninety_five float,
|
||||
sql_max float,
|
||||
|
||||
-- extended timings for individual sql executions
|
||||
individual_sql_avg float,
|
||||
individual_sql_min float,
|
||||
individual_sql_five float,
|
||||
individual_sql_twenty_five float,
|
||||
individual_sql_fifty float,
|
||||
individual_sql_seventy_five float,
|
||||
individual_sql_ninety_five float,
|
||||
individual_sql_max float,
|
||||
|
||||
individual_sql_count integer
|
||||
);
|
||||
""")
|
||||
db.commit()
|
||||
return db
|
||||
|
||||
|
||||
def get_dsn(args):
|
||||
dsn = {}
|
||||
for attr in ('dbname', 'user', 'password', 'host', 'port'):
|
||||
value = getattr(args, f'pg_{attr}')
|
||||
if value:
|
||||
dsn[attr] = value
|
||||
return dsn
|
||||
|
||||
|
||||
def get_servers(args):
|
||||
if '..' in args.server_range:
|
||||
start, end = args.server_range.split('..')
|
||||
else:
|
||||
start = end = args.server_range
|
||||
return [
|
||||
args.server_url.format(i)
|
||||
for i in range(int(start), int(end)+1)
|
||||
]
|
||||
|
||||
|
||||
def get_args():
|
||||
parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter)
|
||||
parser.add_argument("--pg-dbname", default="analytics", help="PostgreSQL database name")
|
||||
parser.add_argument("--pg-user", help="PostgreSQL username")
|
||||
parser.add_argument("--pg-password", help="PostgreSQL password")
|
||||
parser.add_argument("--pg-host", default="localhost", help="PostgreSQL host")
|
||||
parser.add_argument("--pg-port", default="5432", help="PostgreSQL port")
|
||||
parser.add_argument("--server-url", default="http://spv{}.lbry.com:50005", help="URL with '{}' placeholder")
|
||||
parser.add_argument("--server-range", default="1..5", help="Range of numbers or single number to use in URL placeholder")
|
||||
return parser.parse_args()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
args = get_args()
|
||||
asyncio.run(main(get_dsn(args), get_servers(args)))
|
||||
@@ -1,250 +0,0 @@
|
||||
import time
|
||||
from math import ceil
|
||||
|
||||
from aiohttp import web
|
||||
|
||||
from lbry.testcase import CommandTestCase
|
||||
|
||||
|
||||
class MockedCommentServer:
|
||||
|
||||
ERRORS = {
|
||||
'INVALID_PARAMS': {'code': -32602, 'message': 'Invalid parameters'},
|
||||
'INTERNAL': {'code': -32603, 'message': 'An internal error'},
|
||||
'UNKNOWN': {'code': -1, 'message': 'An unknown or very miscellaneous error'},
|
||||
'INVALID_METHOD': {'code': -32604, 'message': 'The Requested method does not exist'}
|
||||
}
|
||||
|
||||
COMMENT_SCHEMA = {
|
||||
'comment': None,
|
||||
'comment_id': None,
|
||||
'claim_id': None,
|
||||
'parent_id': None,
|
||||
'channel_name': None,
|
||||
'channel_id': None,
|
||||
'signature': None,
|
||||
'signing_ts': None,
|
||||
'timestamp': None,
|
||||
'channel_url': None,
|
||||
}
|
||||
|
||||
def __init__(self, port=2903):
|
||||
self.port = port
|
||||
self.app = web.Application(debug=True)
|
||||
self.app.add_routes([web.post('/api', self.api)])
|
||||
self.runner = None
|
||||
self.server = None
|
||||
self.comments = []
|
||||
self.comment_id = 0
|
||||
|
||||
@classmethod
|
||||
def _create_comment(cls, **kwargs):
|
||||
schema = cls.COMMENT_SCHEMA.copy()
|
||||
schema.update(**kwargs)
|
||||
return schema
|
||||
|
||||
@staticmethod
|
||||
def clean(d: dict):
|
||||
return {k: v for k, v in d.items() if v}
|
||||
|
||||
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(
|
||||
comment_id=str(comment_id),
|
||||
channel_name=channel_name,
|
||||
channel_id=channel_id,
|
||||
channel_url=channel_url,
|
||||
timestamp=str(int(time.time())),
|
||||
**kwargs
|
||||
)
|
||||
self.comments.append(comment)
|
||||
return self.clean(comment)
|
||||
|
||||
def delete_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)
|
||||
deleted = True
|
||||
finally:
|
||||
return {
|
||||
str(comment_id): {
|
||||
'deleted': deleted
|
||||
}
|
||||
}
|
||||
|
||||
def get_claim_comments(self, page=1, page_size=50, **kwargs):
|
||||
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]]
|
||||
}
|
||||
|
||||
def get_comment_channel_by_id(self, comment_id: int, **kwargs):
|
||||
comment = self.comments[comment_id - 1]
|
||||
return {
|
||||
'channel_id': comment.get('channel_id'),
|
||||
'channel_name': comment.get('channel_name')
|
||||
}
|
||||
|
||||
methods = {
|
||||
'get_claim_comments': get_claim_comments,
|
||||
'create_comment': create_comment,
|
||||
'delete_comment': delete_comment,
|
||||
'get_channel_from_comment_id': get_comment_channel_by_id,
|
||||
}
|
||||
|
||||
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'])
|
||||
result = self.methods[body['method']](self, **params)
|
||||
response['result'] = result
|
||||
else:
|
||||
response['error'] = self.ERRORS['INVALID_METHOD']
|
||||
except Exception:
|
||||
response['error'] = self.ERRORS['UNKNOWN']
|
||||
return response
|
||||
|
||||
async def start(self):
|
||||
self.runner = web.AppRunner(self.app)
|
||||
await self.runner.setup()
|
||||
self.server = web.TCPSite(self.runner, 'localhost', self.port)
|
||||
await self.server.start()
|
||||
|
||||
async def stop(self):
|
||||
await self.runner.shutdown()
|
||||
await self.runner.cleanup()
|
||||
|
||||
async def api(self, request):
|
||||
body = await request.json()
|
||||
if type(body) is list or type(body) is dict:
|
||||
if type(body) is list:
|
||||
response = [self.process_json(part) for part in body]
|
||||
else:
|
||||
response = self.process_json(body)
|
||||
return web.json_response(response)
|
||||
else:
|
||||
raise TypeError('invalid type passed')
|
||||
|
||||
|
||||
class CommentCommands(CommandTestCase):
|
||||
|
||||
async def asyncSetUp(self):
|
||||
await super().asyncSetUp()
|
||||
self.daemon.conf.comment_server = 'http://localhost:2903/api'
|
||||
self.comment_server = MockedCommentServer(2903)
|
||||
await self.comment_server.start()
|
||||
self.addCleanup(self.comment_server.stop)
|
||||
|
||||
async def test01_comment_create(self):
|
||||
channel = (await self.channel_create('@JimmyBuffett'))['outputs'][0]
|
||||
stream = (await self.stream_create())['outputs'][0]
|
||||
|
||||
self.assertEqual(0, len((await self.daemon.jsonrpc_comment_list(stream['claim_id']))['items']))
|
||||
comment = await self.daemon.jsonrpc_comment_create(
|
||||
claim_id=stream['claim_id'],
|
||||
channel_id=channel['claim_id'],
|
||||
comment="It's 5 O'Clock Somewhere"
|
||||
)
|
||||
comments = (await self.daemon.jsonrpc_comment_list(stream['claim_id']))['items']
|
||||
self.assertEqual(1, len(comments))
|
||||
self.assertEqual(comment['comment_id'], comments[0]['comment_id'])
|
||||
self.assertEqual(stream['claim_id'], comments[0]['claim_id'])
|
||||
|
||||
channel2 = (await self.channel_create('@BuffettJimmy'))['outputs'][0]
|
||||
await self.daemon.jsonrpc_comment_create(
|
||||
claim_id=stream['claim_id'],
|
||||
channel_name=channel2['name'],
|
||||
comment='Let\'s all go to Margaritaville',
|
||||
parent_id=comments[0]['comment_id']
|
||||
)
|
||||
comments = (await self.daemon.jsonrpc_comment_list(stream['claim_id']))['items']
|
||||
self.assertEqual(2, len(comments))
|
||||
self.assertEqual(comments[0]['channel_id'], channel2['claim_id'])
|
||||
self.assertEqual(comments[0]['parent_id'], comments[1]['comment_id'])
|
||||
|
||||
comment = await self.daemon.jsonrpc_comment_create(
|
||||
claim_id=stream['claim_id'],
|
||||
comment='Anonymous comment'
|
||||
)
|
||||
comments = (await self.daemon.jsonrpc_comment_list(stream['claim_id']))['items']
|
||||
self.assertEqual(comment['comment_id'], comments[0]['comment_id'])
|
||||
|
||||
async def test02_unsigned_comment_list(self):
|
||||
stream = (await self.stream_create())['outputs'][0]
|
||||
comments = []
|
||||
for i in range(28):
|
||||
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)
|
||||
for comment in comment_list['items']:
|
||||
self.assertEqual(comment['comment'], comments.pop()['comment'])
|
||||
|
||||
signed_comment_list = await self.daemon.jsonrpc_comment_list(
|
||||
claim_id=stream['claim_id'],
|
||||
is_channel_signature_valid=True
|
||||
)
|
||||
self.assertIs(len(signed_comment_list['items']), 0)
|
||||
|
||||
async def test03_signed_comments_list(self):
|
||||
channel = (await self.channel_create('@JimmyBuffett'))['outputs'][0]
|
||||
stream = (await self.stream_create())['outputs'][0]
|
||||
comments = []
|
||||
for i in range(28):
|
||||
comment = await self.daemon.jsonrpc_comment_create(
|
||||
comment=f'{i}',
|
||||
claim_id=stream['claim_id'],
|
||||
channel_id=channel['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)
|
||||
for comment in comment_list['items']:
|
||||
self.assertEqual(comment['comment'], comments.pop()['comment'])
|
||||
|
||||
signed_comment_list = await self.daemon.jsonrpc_comment_list(
|
||||
claim_id=stream['claim_id'],
|
||||
is_channel_signature_valid=True
|
||||
)
|
||||
self.assertIs(len(signed_comment_list['items']), 28)
|
||||
|
||||
async def test04_comment_abandons(self):
|
||||
rswanson = (await self.channel_create('@RonSwanson'))['outputs'][0]
|
||||
stream = (await self.stream_create('Pawnee Town Hall of Fame by Leslie Knope'))['outputs'][0]
|
||||
comment = await self.daemon.jsonrpc_comment_create(
|
||||
comment='KNOPE! WHAT DID I TELL YOU ABOUT PUTTING MY INFORMATION UP LIKE THAT',
|
||||
claim_id=stream['claim_id'],
|
||||
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'])
|
||||
|
||||
deleted = await self.daemon.jsonrpc_comment_abandon(comment['comment_id'])
|
||||
self.assertIn(comment['comment_id'], deleted)
|
||||
self.assertFalse(deleted[comment['comment_id']]['deleted'])
|
||||
@@ -1,79 +0,0 @@
|
||||
from lbry.testcase import CommandTestCase
|
||||
|
||||
|
||||
class TransactionCommandsTestCase(CommandTestCase):
|
||||
|
||||
async def test_transaction_show(self):
|
||||
# local tx
|
||||
result = await self.out(self.daemon.jsonrpc_account_send(
|
||||
'5.0', await self.daemon.jsonrpc_address_unused(self.account.id)
|
||||
))
|
||||
await self.confirm_tx(result['txid'])
|
||||
tx = await self.daemon.jsonrpc_transaction_show(result['txid'])
|
||||
self.assertEqual(tx.id, result['txid'])
|
||||
|
||||
# someone's tx
|
||||
change_address = await self.blockchain.get_raw_change_address()
|
||||
sendtxid = await self.blockchain.send_to_address(change_address, 10)
|
||||
tx = await self.daemon.jsonrpc_transaction_show(sendtxid)
|
||||
self.assertEqual(tx.id, sendtxid)
|
||||
self.assertEqual(tx.height, -1)
|
||||
await self.generate(1)
|
||||
tx = await self.daemon.jsonrpc_transaction_show(sendtxid)
|
||||
self.assertEqual(tx.height, self.ledger.headers.height)
|
||||
|
||||
# inexistent
|
||||
result = await self.daemon.jsonrpc_transaction_show('0'*64)
|
||||
self.assertFalse(result['success'])
|
||||
|
||||
async def test_utxo_release(self):
|
||||
sendtxid = await self.blockchain.send_to_address(
|
||||
await self.account.receiving.get_or_create_usable_address(), 1
|
||||
)
|
||||
await self.confirm_tx(sendtxid)
|
||||
await self.assertBalance(self.account, '11.0')
|
||||
await self.ledger.reserve_outputs(await self.account.get_utxos())
|
||||
await self.assertBalance(self.account, '0.0')
|
||||
await self.daemon.jsonrpc_utxo_release()
|
||||
await self.assertBalance(self.account, '11.0')
|
||||
|
||||
async def test_granular_balances(self):
|
||||
initial_balance = await self.daemon.jsonrpc_account_balance(reserved_subtotals=True)
|
||||
self.assertEqual({
|
||||
'total': '10.0',
|
||||
'available': '10.0',
|
||||
'reserved': '0.0',
|
||||
'reserved_subtotals': {'claims': '0.0', 'supports': '0.0', 'tips': '0.0'}
|
||||
}, initial_balance)
|
||||
first_claim_id = self.get_claim_id(await self.stream_create('granularity', bid='3.0'))
|
||||
await self.stream_update(first_claim_id, data=b'news', bid='1.0')
|
||||
await self.support_create(first_claim_id, bid='2.0')
|
||||
second_account_id = (await self.out(self.daemon.jsonrpc_account_create("Tip-er")))['id']
|
||||
second_accound_address = await self.daemon.jsonrpc_address_unused(second_account_id)
|
||||
await self.confirm_tx((await self.daemon.jsonrpc_account_send('1.0', second_accound_address)).id)
|
||||
self.assertEqual({
|
||||
'total': '8.97741',
|
||||
'available': '5.97741',
|
||||
'reserved': '3.0',
|
||||
'reserved_subtotals': {'claims': '1.0', 'supports': '2.0', 'tips': '0.0'}
|
||||
}, await self.daemon.jsonrpc_account_balance(reserved_subtotals=True))
|
||||
second_claim_id = self.get_claim_id(await self.stream_create(
|
||||
name='granularity-is-cool', account_id=second_account_id, bid='0.1'))
|
||||
await self.daemon.jsonrpc_support_create(second_claim_id, '0.5', tip=True)
|
||||
first_account_tip_txid = await self.confirm_tx((await self.daemon.jsonrpc_support_create(
|
||||
first_claim_id, '0.3', tip=True, account_id=second_account_id)).id)
|
||||
for with_subtotals in (True, False):
|
||||
self.assertEqual({
|
||||
'total': '8.777264',
|
||||
'available': '5.477264',
|
||||
'reserved': '3.3',
|
||||
'reserved_subtotals': {'claims': '1.0', 'supports': '2.0', 'tips': '0.3'} if with_subtotals else None
|
||||
}, await self.daemon.jsonrpc_account_balance(reserved_subtotals=with_subtotals))
|
||||
await self.confirm_tx((await self.daemon.jsonrpc_support_abandon(txid=first_account_tip_txid, nout=0)).id)
|
||||
for with_subtotals in (True, False):
|
||||
self.assertEqual({
|
||||
'total': '8.777157',
|
||||
'available': '5.777157',
|
||||
'reserved': '3.0',
|
||||
'reserved_subtotals': {'claims': '1.0', 'supports': '2.0', 'tips': '0.0'} if with_subtotals else None
|
||||
}, await self.daemon.jsonrpc_account_balance(reserved_subtotals=with_subtotals))
|
||||
@@ -1,52 +0,0 @@
|
||||
import asyncio
|
||||
import os
|
||||
|
||||
import lbry.wallet
|
||||
from lbry.testcase import CommandTestCase
|
||||
from lbry.extras.daemon.Components import HeadersComponent
|
||||
from torba.client.basenetwork import ClientSession
|
||||
from torba.testcase import IntegrationTestCase
|
||||
|
||||
|
||||
class TestSessionBloat(IntegrationTestCase):
|
||||
"""
|
||||
Tests that server cleans up stale connections after session timeout and client times out too.
|
||||
"""
|
||||
|
||||
LEDGER = lbry.wallet
|
||||
|
||||
async def test_session_bloat_from_socket_timeout(self):
|
||||
await self.conductor.stop_spv()
|
||||
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)
|
||||
await session.create_connection()
|
||||
session.ping_task.cancel()
|
||||
await session.send_request('server.banner', ())
|
||||
self.assertEqual(len(self.conductor.spv_node.server.session_mgr.sessions), 1)
|
||||
self.assertFalse(session.is_closing())
|
||||
await asyncio.sleep(1.1)
|
||||
with self.assertRaises(asyncio.TimeoutError):
|
||||
await session.send_request('server.banner', ())
|
||||
self.assertTrue(session.is_closing())
|
||||
self.assertEqual(len(self.conductor.spv_node.server.session_mgr.sessions), 0)
|
||||
|
||||
|
||||
class TestHeadersComponent(CommandTestCase):
|
||||
|
||||
LEDGER = lbry.wallet
|
||||
|
||||
async def asyncSetUp(self):
|
||||
await super().asyncSetUp()
|
||||
self.component_manager = self.daemon.component_manager
|
||||
self.component_manager.conf.blockchain_name = 'lbrycrd_main'
|
||||
self.headers_component = HeadersComponent(self.component_manager)
|
||||
|
||||
async def test_cant_reach_host(self):
|
||||
HeadersComponent.HEADERS_URL = 'notthere/'
|
||||
os.unlink(self.headers_component.headers.path)
|
||||
# test is that this doesnt raise
|
||||
await self.headers_component.start()
|
||||
self.assertTrue(self.component_manager.get_components_status()['blockchain_headers'])
|
||||
self.assertEqual(await self.headers_component.get_status(), {})
|
||||
@@ -1,59 +0,0 @@
|
||||
from torba.testcase import AsyncioTestCase
|
||||
import hashlib
|
||||
from lbry.extras.daemon.comment_client import sign_comment
|
||||
from lbry.extras.daemon.comment_client import is_comment_signed_by_channel
|
||||
|
||||
from tests.unit.wallet.test_schema_signing import get_stream, get_channel
|
||||
|
||||
|
||||
class TestSigningComments(AsyncioTestCase):
|
||||
|
||||
@staticmethod
|
||||
def create_claim_comment_body(comment, claim, channel):
|
||||
return {
|
||||
'claim_id': claim.claim_id,
|
||||
'channel_name': channel.claim_name,
|
||||
'channel_id': channel.claim_id,
|
||||
'comment': comment,
|
||||
'comment_id': hashlib.sha256(comment.encode()).hexdigest()
|
||||
}
|
||||
|
||||
def test01_successful_create_sign_and_validate_comment(self):
|
||||
channel = get_channel('@BusterBluth')
|
||||
stream = get_stream('pop secret')
|
||||
comment = self.create_claim_comment_body('Cool stream', stream, channel)
|
||||
sign_comment(comment, channel)
|
||||
self.assertTrue(is_comment_signed_by_channel(comment, channel))
|
||||
|
||||
def test02_fail_to_validate_spoofed_channel(self):
|
||||
pdiddy = get_channel('@PDitty')
|
||||
channel2 = get_channel('@TomHaverford')
|
||||
stream = get_stream()
|
||||
comment = self.create_claim_comment_body('Woahh This is Sick!! Shout out 2 my boy Tommy H', stream, pdiddy)
|
||||
sign_comment(comment, channel2)
|
||||
self.assertFalse(is_comment_signed_by_channel(comment, pdiddy))
|
||||
|
||||
def test03_successful_sign_abandon_comment(self):
|
||||
rswanson = get_channel('@RonSwanson')
|
||||
dsilver = get_stream('Welcome to the Pawnee, and give a big round for Ron Swanson, AKA Duke Silver')
|
||||
comment_body = self.create_claim_comment_body('COMPUTER, DELETE ALL VIDEOS OF RON.', dsilver, rswanson)
|
||||
sign_comment(comment_body, rswanson, abandon=True)
|
||||
self.assertTrue(is_comment_signed_by_channel(comment_body, rswanson, abandon=True))
|
||||
|
||||
def test04_invalid_signature(self):
|
||||
rswanson = get_channel('@RonSwanson')
|
||||
jeanralphio = get_channel('@JeanRalphio')
|
||||
chair = get_stream('This is a nice chair. I made it with Mahogany wood and this electric saw')
|
||||
chair_comment = self.create_claim_comment_body(
|
||||
'Hah. You use an electric saw? Us swansons have been making chairs with handsaws just three after birth.',
|
||||
chair,
|
||||
rswanson
|
||||
)
|
||||
sign_comment(chair_comment, rswanson)
|
||||
self.assertTrue(is_comment_signed_by_channel(chair_comment, rswanson))
|
||||
self.assertFalse(is_comment_signed_by_channel(chair_comment, jeanralphio))
|
||||
fake_abandon_signal = chair_comment.copy()
|
||||
sign_comment(fake_abandon_signal, jeanralphio, abandon=True)
|
||||
self.assertFalse(is_comment_signed_by_channel(fake_abandon_signal, rswanson, abandon=True))
|
||||
self.assertFalse(is_comment_signed_by_channel(fake_abandon_signal, jeanralphio, abandon=True))
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
import unittest
|
||||
|
||||
from lbry.schema.tags import normalize_tag, clean_tags
|
||||
|
||||
|
||||
class TestTagNormalization(unittest.TestCase):
|
||||
|
||||
def assertNormalizedTag(self, clean, dirty):
|
||||
self.assertEqual(clean, normalize_tag(dirty))
|
||||
|
||||
def test_normalize_tag(self):
|
||||
tag = self.assertNormalizedTag
|
||||
tag('', ' \t #!~')
|
||||
tag('tag', 'T\'ag')
|
||||
tag('t ag', '\tT \nAG ')
|
||||
tag('tag hash', '#tag~#hash!')
|
||||
|
||||
def test_clean_tags(self):
|
||||
self.assertEqual(['tag'], clean_tags([' \t #!~', '!taG', '\t']))
|
||||
cleaned = clean_tags(['fOo', '!taG', 'FoO'])
|
||||
self.assertIn('tag', cleaned)
|
||||
self.assertIn('foo', cleaned)
|
||||
self.assertEqual(len(cleaned), 2)
|
||||
@@ -1,60 +0,0 @@
|
||||
import time
|
||||
import unittest
|
||||
from lbry.wallet.server.metrics import ServerLoadData, calculate_avg_percentiles
|
||||
|
||||
|
||||
class TestPercentileCalculation(unittest.TestCase):
|
||||
|
||||
def test_calculate_percentiles(self):
|
||||
self.assertEqual(calculate_avg_percentiles([]), (0, 0, 0, 0, 0, 0, 0, 0))
|
||||
self.assertEqual(calculate_avg_percentiles([1]), (1, 1, 1, 1, 1, 1, 1, 1))
|
||||
self.assertEqual(calculate_avg_percentiles([1, 2]), (1, 1, 1, 1, 1, 2, 2, 2))
|
||||
self.assertEqual(calculate_avg_percentiles([1, 2, 3]), (2, 1, 1, 1, 2, 3, 3, 3))
|
||||
self.assertEqual(calculate_avg_percentiles([4, 1, 2, 3]), (2, 1, 1, 1, 2, 3, 4, 4))
|
||||
self.assertEqual(calculate_avg_percentiles([1, 2, 3, 4, 5, 6]), (3, 1, 1, 2, 3, 5, 6, 6))
|
||||
self.assertEqual(calculate_avg_percentiles(
|
||||
list(range(1, 101))), (50, 1, 5, 25, 50, 75, 95, 100))
|
||||
|
||||
|
||||
class TestCollectingMetrics(unittest.TestCase):
|
||||
|
||||
def test_happy_path(self):
|
||||
self.maxDiff = None
|
||||
load = ServerLoadData()
|
||||
search = load.for_api('search')
|
||||
self.assertEqual(search.name, 'search')
|
||||
search.start()
|
||||
search.cache_response()
|
||||
search.cache_response()
|
||||
metrics = {
|
||||
'search': [{'total': 40}],
|
||||
'execute_query': [
|
||||
{'total': 20},
|
||||
{'total': 10}
|
||||
]
|
||||
}
|
||||
for x in range(5):
|
||||
search.query_response(time.perf_counter() - 0.055 + 0.001*x, metrics)
|
||||
metrics['execute_query'][0]['total'] = 10
|
||||
metrics['execute_query'][0]['sql'] = "select lots, of, stuff FROM claim where something=1"
|
||||
search.query_interrupt(time.perf_counter() - 0.050, metrics)
|
||||
search.query_error(time.perf_counter() - 0.050, metrics)
|
||||
search.query_error(time.perf_counter() - 0.052, {})
|
||||
self.assertEqual(load.to_json_and_reset({}), {'status': {}, 'api': {'search': {
|
||||
"receive_count": 1,
|
||||
"cache_response_count": 2,
|
||||
"query_response_count": 5,
|
||||
"intrp_response_count": 1,
|
||||
"error_response_count": 2,
|
||||
"response": (53, 51, 51, 52, 53, 54, 55, 55),
|
||||
"interrupt": (50, 50, 50, 50, 50, 50, 50, 50),
|
||||
"error": (51, 50, 50, 50, 50, 52, 52, 52),
|
||||
"python": (12, 10, 10, 10, 10, 20, 20, 20),
|
||||
"wait": (12, 10, 10, 10, 12, 14, 15, 15),
|
||||
"sql": (27, 20, 20, 20, 30, 30, 30, 30),
|
||||
"individual_sql": (13, 10, 10, 10, 10, 20, 20, 20),
|
||||
"individual_sql_count": 14,
|
||||
"errored_queries": ['FROM claim where something=1'],
|
||||
"interrupted_queries": ['FROM claim where something=1'],
|
||||
}}})
|
||||
self.assertEqual(load.to_json_and_reset({}), {'status': {}, 'api': {}})
|
||||
@@ -0,0 +1,4 @@
|
||||
__name__ = "lbrynet"
|
||||
__version__ = "0.38.0rc6"
|
||||
version = tuple(__version__.split('.'))
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from lbry.cryptoutils import get_lbry_hash_obj
|
||||
from lbrynet.cryptoutils import get_lbry_hash_obj
|
||||
|
||||
MAX_BLOB_SIZE = 2 * 2 ** 20
|
||||
|
||||
@@ -10,12 +10,12 @@ from cryptography.hazmat.primitives.ciphers import Cipher, modes
|
||||
from cryptography.hazmat.primitives.ciphers.algorithms import AES
|
||||
from cryptography.hazmat.primitives.padding import PKCS7
|
||||
|
||||
from lbry.cryptoutils import backend, get_lbry_hash_obj
|
||||
from lbry.error import DownloadCancelledError, InvalidBlobHashError, InvalidDataError
|
||||
from lbrynet.cryptoutils import backend, get_lbry_hash_obj
|
||||
from lbrynet.error import DownloadCancelledError, InvalidBlobHashError, InvalidDataError
|
||||
|
||||
from lbry.blob import MAX_BLOB_SIZE, blobhash_length
|
||||
from lbry.blob.blob_info import BlobInfo
|
||||
from lbry.blob.writer import HashBlobWriter
|
||||
from lbrynet.blob import MAX_BLOB_SIZE, blobhash_length
|
||||
from lbrynet.blob.blob_info import BlobInfo
|
||||
from lbrynet.blob.writer import HashBlobWriter
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
@@ -71,7 +71,7 @@ class AbstractBlob:
|
||||
'readers'
|
||||
]
|
||||
|
||||
def __init__(self, loop: asyncio.AbstractEventLoop, blob_hash: str, length: typing.Optional[int] = None,
|
||||
def __init__(self, loop: asyncio.BaseEventLoop, blob_hash: str, length: typing.Optional[int] = None,
|
||||
blob_completed_callback: typing.Optional[typing.Callable[['AbstractBlob'], asyncio.Task]] = None,
|
||||
blob_directory: typing.Optional[str] = None):
|
||||
self.loop = loop
|
||||
@@ -175,7 +175,7 @@ class AbstractBlob:
|
||||
|
||||
@classmethod
|
||||
async def create_from_unencrypted(
|
||||
cls, loop: asyncio.AbstractEventLoop, blob_dir: typing.Optional[str], key: bytes, iv: bytes,
|
||||
cls, loop: asyncio.BaseEventLoop, blob_dir: typing.Optional[str], key: bytes, iv: bytes,
|
||||
unencrypted: bytes, blob_num: int,
|
||||
blob_completed_callback: typing.Optional[typing.Callable[['AbstractBlob'], None]] = None) -> BlobInfo:
|
||||
"""
|
||||
@@ -237,7 +237,7 @@ class BlobBuffer(AbstractBlob):
|
||||
"""
|
||||
An in-memory only blob
|
||||
"""
|
||||
def __init__(self, loop: asyncio.AbstractEventLoop, blob_hash: str, length: typing.Optional[int] = None,
|
||||
def __init__(self, loop: asyncio.BaseEventLoop, blob_hash: str, length: typing.Optional[int] = None,
|
||||
blob_completed_callback: typing.Optional[typing.Callable[['AbstractBlob'], asyncio.Task]] = None,
|
||||
blob_directory: typing.Optional[str] = None):
|
||||
self._verified_bytes: typing.Optional[BytesIO] = None
|
||||
@@ -276,7 +276,7 @@ class BlobFile(AbstractBlob):
|
||||
"""
|
||||
A blob existing on the local file system
|
||||
"""
|
||||
def __init__(self, loop: asyncio.AbstractEventLoop, blob_hash: str, length: typing.Optional[int] = None,
|
||||
def __init__(self, loop: asyncio.BaseEventLoop, blob_hash: str, length: typing.Optional[int] = None,
|
||||
blob_completed_callback: typing.Optional[typing.Callable[['AbstractBlob'], asyncio.Task]] = None,
|
||||
blob_directory: typing.Optional[str] = None):
|
||||
super().__init__(loop, blob_hash, length, blob_completed_callback, blob_directory)
|
||||
@@ -324,7 +324,7 @@ class BlobFile(AbstractBlob):
|
||||
|
||||
@classmethod
|
||||
async def create_from_unencrypted(
|
||||
cls, loop: asyncio.AbstractEventLoop, blob_dir: typing.Optional[str], key: bytes, iv: bytes,
|
||||
cls, loop: asyncio.BaseEventLoop, blob_dir: typing.Optional[str], key: bytes, iv: bytes,
|
||||
unencrypted: bytes, blob_num: int,
|
||||
blob_completed_callback: typing.Optional[typing.Callable[['AbstractBlob'],
|
||||
asyncio.Task]] = None) -> BlobInfo:
|
||||
@@ -2,21 +2,21 @@ import os
|
||||
import typing
|
||||
import asyncio
|
||||
import logging
|
||||
from lbry.utils import LRUCache
|
||||
from lbry.blob.blob_file import is_valid_blobhash, BlobFile, BlobBuffer, AbstractBlob
|
||||
from lbry.stream.descriptor import StreamDescriptor
|
||||
from lbry.connection_manager import ConnectionManager
|
||||
from lbrynet.utils import LRUCache
|
||||
from lbrynet.blob.blob_file import is_valid_blobhash, BlobFile, BlobBuffer, AbstractBlob
|
||||
from lbrynet.stream.descriptor import StreamDescriptor
|
||||
from lbrynet.connection_manager import ConnectionManager
|
||||
|
||||
if typing.TYPE_CHECKING:
|
||||
from lbry.conf import Config
|
||||
from lbry.dht.protocol.data_store import DictDataStore
|
||||
from lbry.extras.daemon.storage import SQLiteStorage
|
||||
from lbrynet.conf import Config
|
||||
from lbrynet.dht.protocol.data_store import DictDataStore
|
||||
from lbrynet.extras.daemon.storage import SQLiteStorage
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class BlobManager:
|
||||
def __init__(self, loop: asyncio.AbstractEventLoop, blob_dir: str, storage: 'SQLiteStorage', config: 'Config',
|
||||
def __init__(self, loop: asyncio.BaseEventLoop, blob_dir: str, storage: 'SQLiteStorage', config: 'Config',
|
||||
node_data_store: typing.Optional['DictDataStore'] = None):
|
||||
"""
|
||||
This class stores blobs on the hard disk
|
||||
@@ -69,10 +69,10 @@ class BlobManager:
|
||||
def is_blob_verified(self, blob_hash: str, length: typing.Optional[int] = None) -> bool:
|
||||
if not is_valid_blobhash(blob_hash):
|
||||
raise ValueError(blob_hash)
|
||||
if not os.path.isfile(os.path.join(self.blob_dir, blob_hash)):
|
||||
return False
|
||||
if blob_hash in self.blobs:
|
||||
return self.blobs[blob_hash].get_is_verified()
|
||||
if not os.path.isfile(os.path.join(self.blob_dir, blob_hash)):
|
||||
return False
|
||||
return self._get_blob(blob_hash, length).get_is_verified()
|
||||
|
||||
async def setup(self) -> bool:
|
||||
@@ -86,8 +86,7 @@ class BlobManager:
|
||||
to_add = await self.storage.sync_missing_blobs(in_blobfiles_dir)
|
||||
if to_add:
|
||||
self.completed_blob_hashes.update(to_add)
|
||||
if self.config.track_bandwidth:
|
||||
self.connection_manager.start()
|
||||
self.connection_manager.start()
|
||||
return True
|
||||
|
||||
def stop(self):
|
||||
@@ -2,8 +2,8 @@ import typing
|
||||
import logging
|
||||
import asyncio
|
||||
from io import BytesIO
|
||||
from lbry.error import InvalidBlobHashError, InvalidDataError
|
||||
from lbry.cryptoutils import get_lbry_hash_obj
|
||||
from lbrynet.error import InvalidBlobHashError, InvalidDataError
|
||||
from lbrynet.cryptoutils import get_lbry_hash_obj
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
@@ -2,19 +2,19 @@ import asyncio
|
||||
import logging
|
||||
import typing
|
||||
import binascii
|
||||
from lbry.error import InvalidBlobHashError, InvalidDataError
|
||||
from lbry.blob_exchange.serialization import BlobResponse, BlobRequest
|
||||
from lbry.utils import cache_concurrent
|
||||
from lbrynet.error import InvalidBlobHashError, InvalidDataError
|
||||
from lbrynet.blob_exchange.serialization import BlobResponse, BlobRequest
|
||||
from lbrynet.utils import cache_concurrent
|
||||
if typing.TYPE_CHECKING:
|
||||
from lbry.blob.blob_file import AbstractBlob
|
||||
from lbry.blob.writer import HashBlobWriter
|
||||
from lbry.connection_manager import ConnectionManager
|
||||
from lbrynet.blob.blob_file import AbstractBlob
|
||||
from lbrynet.blob.writer import HashBlobWriter
|
||||
from lbrynet.connection_manager import ConnectionManager
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class BlobExchangeClientProtocol(asyncio.Protocol):
|
||||
def __init__(self, loop: asyncio.AbstractEventLoop, peer_timeout: typing.Optional[float] = 10,
|
||||
def __init__(self, loop: asyncio.BaseEventLoop, peer_timeout: typing.Optional[float] = 10,
|
||||
connection_manager: typing.Optional['ConnectionManager'] = None):
|
||||
self.loop = loop
|
||||
self.peer_port: typing.Optional[int] = None
|
||||
@@ -39,6 +39,8 @@ class BlobExchangeClientProtocol(asyncio.Protocol):
|
||||
self.peer_address, self.peer_port = addr_info
|
||||
# assert self.peer_address is not None
|
||||
self.connection_manager.received_data(f"{self.peer_address}:{self.peer_port}", len(data))
|
||||
#log.debug("%s:%d -- got %s bytes -- %s bytes on buffer -- %s blob bytes received",
|
||||
# self.peer_address, self.peer_port, len(data), len(self.buf), self._blob_bytes_received)
|
||||
if not self.transport or self.transport.is_closing():
|
||||
log.warning("transport closing, but got more bytes from %s:%i\n%s", self.peer_address, self.peer_port,
|
||||
binascii.hexlify(data))
|
||||
@@ -89,7 +91,7 @@ class BlobExchangeClientProtocol(asyncio.Protocol):
|
||||
log.error("error downloading blob from %s:%i: %s", self.peer_address, self.peer_port, err)
|
||||
if self._response_fut and not self._response_fut.done():
|
||||
self._response_fut.set_exception(err)
|
||||
except asyncio.TimeoutError as err:
|
||||
except (asyncio.TimeoutError) as err: # TODO: is this needed?
|
||||
log.error("%s downloading blob from %s:%i", str(err), self.peer_address, self.peer_port)
|
||||
if self._response_fut and not self._response_fut.done():
|
||||
self._response_fut.set_exception(err)
|
||||
@@ -123,16 +125,11 @@ class BlobExchangeClientProtocol(asyncio.Protocol):
|
||||
self.peer_port)
|
||||
log.warning(response.to_dict())
|
||||
return self._blob_bytes_received, self.close()
|
||||
elif availability_response and availability_response.available_blobs and \
|
||||
elif availability_response.available_blobs and \
|
||||
availability_response.available_blobs != [self.blob.blob_hash]:
|
||||
log.warning("blob availability response doesn't match our request from %s:%i",
|
||||
self.peer_address, self.peer_port)
|
||||
return self._blob_bytes_received, self.close()
|
||||
elif not availability_response:
|
||||
log.warning("response from %s:%i did not include an availability response (we requested %s)",
|
||||
self.peer_address, self.peer_port, blob_hash)
|
||||
return self._blob_bytes_received, self.close()
|
||||
|
||||
if not price_response or price_response.blob_data_payment_rate != 'RATE_ACCEPTED':
|
||||
log.warning("data rate rejected by %s:%i", self.peer_address, self.peer_port)
|
||||
return self._blob_bytes_received, self.close()
|
||||
@@ -183,9 +180,9 @@ class BlobExchangeClientProtocol(asyncio.Protocol):
|
||||
self.blob, self.writer = blob, blob.get_blob_writer(self.peer_address, self.peer_port)
|
||||
self._response_fut = asyncio.Future(loop=self.loop)
|
||||
return await self._download_blob()
|
||||
except OSError:
|
||||
except OSError as e:
|
||||
# i'm not sure how to fix this race condition - jack
|
||||
log.warning("race happened downloading %s from %s:%s", blob_hash, self.peer_address, self.peer_port)
|
||||
log.warning("race happened downloading %s from %s:%i", blob_hash, self.peer_address, self.peer_port)
|
||||
# return self._blob_bytes_received, self.transport
|
||||
raise
|
||||
except asyncio.TimeoutError:
|
||||
@@ -218,8 +215,8 @@ class BlobExchangeClientProtocol(asyncio.Protocol):
|
||||
|
||||
|
||||
@cache_concurrent
|
||||
async def request_blob(loop: asyncio.AbstractEventLoop, blob: typing.Optional['AbstractBlob'], address: str,
|
||||
tcp_port: int, peer_connect_timeout: float, blob_download_timeout: float,
|
||||
async def request_blob(loop: asyncio.BaseEventLoop, blob: 'AbstractBlob', address: str, tcp_port: int,
|
||||
peer_connect_timeout: float, blob_download_timeout: float,
|
||||
connected_transport: asyncio.Transport = None, connection_id: int = 0,
|
||||
connection_manager: typing.Optional['ConnectionManager'] = None)\
|
||||
-> typing.Tuple[int, typing.Optional[asyncio.Transport]]:
|
||||
@@ -240,9 +237,7 @@ async def request_blob(loop: asyncio.AbstractEventLoop, blob: typing.Optional['A
|
||||
if not connected_transport:
|
||||
await asyncio.wait_for(loop.create_connection(lambda: protocol, address, tcp_port),
|
||||
peer_connect_timeout, loop=loop)
|
||||
connected_transport = protocol.transport
|
||||
if blob is None or blob.get_is_verified() or not blob.is_writeable():
|
||||
# blob is None happens when we are just opening a connection
|
||||
if blob.get_is_verified() or not blob.is_writeable():
|
||||
# file exists but not verified means someone is writing right now, give it time, come back later
|
||||
return 0, connected_transport
|
||||
return await protocol.download_blob(blob)
|
||||
@@ -1,14 +1,14 @@
|
||||
import asyncio
|
||||
import typing
|
||||
import logging
|
||||
from lbry.utils import cache_concurrent
|
||||
from lbry.blob_exchange.client import request_blob
|
||||
from lbrynet.utils import cache_concurrent
|
||||
from lbrynet.blob_exchange.client import request_blob
|
||||
if typing.TYPE_CHECKING:
|
||||
from lbry.conf import Config
|
||||
from lbry.dht.node import Node
|
||||
from lbry.dht.peer import KademliaPeer
|
||||
from lbry.blob.blob_manager import BlobManager
|
||||
from lbry.blob.blob_file import AbstractBlob
|
||||
from lbrynet.conf import Config
|
||||
from lbrynet.dht.node import Node
|
||||
from lbrynet.dht.peer import KademliaPeer
|
||||
from lbrynet.blob.blob_manager import BlobManager
|
||||
from lbrynet.blob.blob_file import AbstractBlob
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
@@ -16,7 +16,7 @@ log = logging.getLogger(__name__)
|
||||
class BlobDownloader:
|
||||
BAN_FACTOR = 2.0 # fixme: when connection manager gets implemented, move it out from here
|
||||
|
||||
def __init__(self, loop: asyncio.AbstractEventLoop, config: 'Config', blob_manager: 'BlobManager',
|
||||
def __init__(self, loop: asyncio.BaseEventLoop, config: 'Config', blob_manager: 'BlobManager',
|
||||
peer_queue: asyncio.Queue):
|
||||
self.loop = loop
|
||||
self.config = config
|
||||
@@ -26,30 +26,25 @@ class BlobDownloader:
|
||||
self.ignored: typing.Dict['KademliaPeer', int] = {}
|
||||
self.scores: typing.Dict['KademliaPeer', int] = {}
|
||||
self.failures: typing.Dict['KademliaPeer', int] = {}
|
||||
self.connection_failures: typing.List['KademliaPeer'] = []
|
||||
self.connections: typing.Dict['KademliaPeer', asyncio.Transport] = {}
|
||||
self.is_running = asyncio.Event(loop=self.loop)
|
||||
|
||||
def should_race_continue(self, blob: 'AbstractBlob'):
|
||||
max_probes = self.config.max_connections_per_download * (1 if self.connections else 10)
|
||||
if len(self.active_connections) >= max_probes:
|
||||
if len(self.active_connections) >= self.config.max_connections_per_download:
|
||||
return False
|
||||
return not (blob.get_is_verified() or not blob.is_writeable())
|
||||
|
||||
async def request_blob_from_peer(self, blob: 'AbstractBlob', peer: 'KademliaPeer', connection_id: int = 0,
|
||||
just_probe: bool = False):
|
||||
async def request_blob_from_peer(self, blob: 'AbstractBlob', peer: 'KademliaPeer', connection_id: int = 0):
|
||||
if blob.get_is_verified():
|
||||
return
|
||||
transport = self.connections.get(peer)
|
||||
start = self.loop.time()
|
||||
bytes_received, transport = await request_blob(
|
||||
self.loop, blob if not just_probe else None, peer.address, peer.tcp_port, self.config.peer_connect_timeout,
|
||||
self.loop, blob, peer.address, peer.tcp_port, self.config.peer_connect_timeout,
|
||||
self.config.blob_download_timeout, connected_transport=transport, connection_id=connection_id,
|
||||
connection_manager=self.blob_manager.connection_manager
|
||||
|
||||
)
|
||||
if not bytes_received and not transport and peer not in self.connection_failures:
|
||||
self.connection_failures.append(peer)
|
||||
if not transport and peer not in self.ignored:
|
||||
self.ignored[peer] = self.loop.time()
|
||||
log.debug("drop peer %s:%i", peer.address, peer.tcp_port)
|
||||
@@ -96,18 +91,16 @@ class BlobDownloader:
|
||||
if batch:
|
||||
self.peer_queue.put_nowait(list(batch))
|
||||
log.debug(
|
||||
"running, %d peers, %d ignored, %d active, %s connections",
|
||||
len(batch), len(self.ignored), len(self.active_connections), len(self.connections)
|
||||
"running, %d peers, %d ignored, %d active",
|
||||
len(batch), len(self.ignored), len(self.active_connections)
|
||||
)
|
||||
for peer in sorted(batch, key=lambda peer: self.scores.get(peer, 0), reverse=True):
|
||||
if peer in self.ignored or peer in self.active_connections:
|
||||
continue
|
||||
if not self.should_race_continue(blob):
|
||||
break
|
||||
log.debug("request %s from %s:%i", blob_hash[:8], peer.address, peer.tcp_port)
|
||||
just_probe = len(self.connections) == 0
|
||||
t = self.loop.create_task(self.request_blob_from_peer(blob, peer, connection_id, just_probe))
|
||||
self.active_connections[peer] = t
|
||||
if peer not in self.active_connections and peer not in self.ignored:
|
||||
log.debug("request %s from %s:%i", blob_hash[:8], peer.address, peer.tcp_port)
|
||||
t = self.loop.create_task(self.request_blob_from_peer(blob, peer, connection_id))
|
||||
self.active_connections[peer] = t
|
||||
await self.new_peer_or_finished()
|
||||
self.cleanup_active()
|
||||
log.debug("downloaded %s", blob_hash[:8])
|
||||
@@ -116,7 +109,6 @@ class BlobDownloader:
|
||||
blob.close()
|
||||
|
||||
def close(self):
|
||||
self.connection_failures.clear()
|
||||
self.scores.clear()
|
||||
self.ignored.clear()
|
||||
self.is_running.clear()
|
||||
@@ -3,18 +3,18 @@ import binascii
|
||||
import logging
|
||||
import typing
|
||||
from json.decoder import JSONDecodeError
|
||||
from lbry.blob_exchange.serialization import BlobResponse, BlobRequest, blob_response_types
|
||||
from lbry.blob_exchange.serialization import BlobAvailabilityResponse, BlobPriceResponse, BlobDownloadResponse, \
|
||||
from lbrynet.blob_exchange.serialization import BlobResponse, BlobRequest, blob_response_types
|
||||
from lbrynet.blob_exchange.serialization import BlobAvailabilityResponse, BlobPriceResponse, BlobDownloadResponse, \
|
||||
BlobPaymentAddressResponse
|
||||
|
||||
if typing.TYPE_CHECKING:
|
||||
from lbry.blob.blob_manager import BlobManager
|
||||
from lbrynet.blob.blob_manager import BlobManager
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class BlobServerProtocol(asyncio.Protocol):
|
||||
def __init__(self, loop: asyncio.AbstractEventLoop, blob_manager: 'BlobManager', lbrycrd_address: str):
|
||||
def __init__(self, loop: asyncio.BaseEventLoop, blob_manager: 'BlobManager', lbrycrd_address: str):
|
||||
self.loop = loop
|
||||
self.blob_manager = blob_manager
|
||||
self.server_task: asyncio.Task = None
|
||||
@@ -103,7 +103,7 @@ class BlobServerProtocol(asyncio.Protocol):
|
||||
|
||||
|
||||
class BlobServer:
|
||||
def __init__(self, loop: asyncio.AbstractEventLoop, blob_manager: 'BlobManager', lbrycrd_address: str):
|
||||
def __init__(self, loop: asyncio.BaseEventLoop, blob_manager: 'BlobManager', lbrycrd_address: str):
|
||||
self.loop = loop
|
||||
self.blob_manager = blob_manager
|
||||
self.server_task: typing.Optional[asyncio.Task] = None
|
||||
@@ -7,9 +7,8 @@ import yaml
|
||||
from argparse import ArgumentParser
|
||||
from contextlib import contextmanager
|
||||
from appdirs import user_data_dir, user_config_dir
|
||||
from lbry.error import InvalidCurrencyError
|
||||
from lbry.dht import constants
|
||||
from torba.client.coinselection import STRATEGIES
|
||||
from lbrynet.error import InvalidCurrencyError
|
||||
from lbrynet.dht import constants
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
@@ -22,6 +21,9 @@ CURRENCIES = {
|
||||
'LBC': {'type': 'crypto'},
|
||||
'USD': {'type': 'fiat'},
|
||||
}
|
||||
HEADERS_FILE_SHA256_CHECKSUM = (
|
||||
366295, 'b0c8197153a33ccbc52fb81a279588b6015b68b7726f73f6a2b81f7e25bfe4b9'
|
||||
)
|
||||
|
||||
|
||||
class Setting(typing.Generic[T]):
|
||||
@@ -190,21 +192,6 @@ class MaxKeyFee(Setting[dict]):
|
||||
)
|
||||
|
||||
|
||||
class StringChoice(String):
|
||||
def __init__(self, doc: str, valid_values: typing.List[str], default: str, *args, **kwargs):
|
||||
super().__init__(doc, default, *args, **kwargs)
|
||||
if not valid_values:
|
||||
raise ValueError("No valid values provided")
|
||||
if default not in valid_values:
|
||||
raise ValueError(f"Default value must be one of: {', '.join(valid_values)}")
|
||||
self.valid_values = valid_values
|
||||
|
||||
def validate(self, val):
|
||||
super().validate(val)
|
||||
if val not in self.valid_values:
|
||||
raise ValueError(f"Setting '{self.name}' value must be one of: {', '.join(self.valid_values)}")
|
||||
|
||||
|
||||
class ListSetting(Setting[list]):
|
||||
|
||||
def validate(self, val):
|
||||
@@ -359,9 +346,6 @@ class ConfigFileAccess:
|
||||
del self.data[key]
|
||||
|
||||
|
||||
TBC = typing.TypeVar('TBC', bound='BaseConfig')
|
||||
|
||||
|
||||
class BaseConfig:
|
||||
|
||||
config = Path("Path to configuration file.", metavar='FILE')
|
||||
@@ -418,7 +402,7 @@ class BaseConfig:
|
||||
}
|
||||
|
||||
@classmethod
|
||||
def create_from_arguments(cls, args) -> TBC:
|
||||
def create_from_arguments(cls, args):
|
||||
conf = cls()
|
||||
conf.set_arguments(args)
|
||||
conf.set_environment()
|
||||
@@ -545,15 +529,9 @@ class Config(CLIConfig):
|
||||
('reflector.lbry.com', 5566)
|
||||
])
|
||||
lbryum_servers = Servers("SPV wallet servers", [
|
||||
('spv1.lbry.com', 50001),
|
||||
('spv2.lbry.com', 50001),
|
||||
('spv3.lbry.com', 50001),
|
||||
('spv4.lbry.com', 50001),
|
||||
('spv5.lbry.com', 50001),
|
||||
('spv6.lbry.com', 50001),
|
||||
('spv7.lbry.com', 50001),
|
||||
('spv8.lbry.com', 50001),
|
||||
('spv9.lbry.com', 50001),
|
||||
('lbryumx1.lbry.com', 50001), # US EAST
|
||||
('lbryumx2.lbry.com', 50001), # US EAST
|
||||
('lbryumx4.lbry.com', 50001) #EU
|
||||
])
|
||||
known_dht_nodes = Servers("Known nodes for bootstrapping connection to the DHT", [
|
||||
('lbrynet1.lbry.com', 4444), # US EAST
|
||||
@@ -576,18 +554,14 @@ class Config(CLIConfig):
|
||||
"Whether to share usage stats and diagnostic info with LBRY.", True,
|
||||
previous_names=['upload_log', 'upload_log', 'share_debug_info']
|
||||
)
|
||||
track_bandwidth = Toggle("Track bandwidth usage", True)
|
||||
|
||||
# media server
|
||||
|
||||
streaming_server = String('Host name and port to serve streaming media over range requests',
|
||||
'localhost:5280', metavar='HOST:PORT')
|
||||
streaming_get = Toggle("Enable the /get endpoint for the streaming media server. "
|
||||
"Disable to prevent new streams from being added.", True)
|
||||
|
||||
coin_selection_strategy = StringChoice(
|
||||
"Strategy to use when selecting UTXOs for a transaction",
|
||||
STRATEGIES, "standard")
|
||||
|
||||
@property
|
||||
def streaming_host(self):
|
||||
return self.streaming_server.split(':')[0]
|
||||
@@ -621,7 +595,7 @@ class Config(CLIConfig):
|
||||
|
||||
|
||||
def get_windows_directories() -> typing.Tuple[str, str, str]:
|
||||
from lbry.winpaths import get_path, FOLDERID, UserHandle
|
||||
from lbrynet.winpaths import get_path, FOLDERID, UserHandle
|
||||
|
||||
download_dir = get_path(FOLDERID.Downloads, UserHandle.current)
|
||||
|
||||
@@ -19,9 +19,7 @@ class ConnectionManager:
|
||||
self.outgoing_connected: typing.Set[str] = set()
|
||||
self.outgoing: typing.DefaultDict[str, int] = collections.defaultdict(int)
|
||||
self._status = {}
|
||||
self._total_sent = 0
|
||||
self._total_received = 0
|
||||
self._running = False
|
||||
|
||||
self._task: typing.Optional[asyncio.Task] = None
|
||||
|
||||
@property
|
||||
@@ -29,37 +27,33 @@ class ConnectionManager:
|
||||
return self._status
|
||||
|
||||
def sent_data(self, host_and_port: str, size: int):
|
||||
if self._running:
|
||||
self.outgoing[host_and_port] += size
|
||||
self.outgoing[host_and_port] += size
|
||||
|
||||
def received_data(self, host_and_port: str, size: int):
|
||||
if self._running:
|
||||
self.incoming[host_and_port] += size
|
||||
self.incoming[host_and_port] += size
|
||||
|
||||
def connection_made(self, host_and_port: str):
|
||||
if self._running:
|
||||
self.outgoing_connected.add(host_and_port)
|
||||
self.outgoing_connected.add(host_and_port)
|
||||
|
||||
def connection_received(self, host_and_port: str):
|
||||
# self.incoming_connected.add(host_and_port)
|
||||
pass
|
||||
|
||||
def outgoing_connection_lost(self, host_and_port: str):
|
||||
if self._running and host_and_port in self.outgoing_connected:
|
||||
if host_and_port in self.outgoing_connected:
|
||||
self.outgoing_connected.remove(host_and_port)
|
||||
|
||||
def incoming_connection_lost(self, host_and_port: str):
|
||||
if self._running and host_and_port in self.incoming_connected:
|
||||
if host_and_port in self.incoming_connected:
|
||||
self.incoming_connected.remove(host_and_port)
|
||||
|
||||
async def _update(self):
|
||||
|
||||
self._status = {
|
||||
'incoming_bps': {},
|
||||
'outgoing_bps': {},
|
||||
'total_incoming_mbs': 0.0,
|
||||
'total_outgoing_mbs': 0.0,
|
||||
'total_sent': self._total_sent,
|
||||
'total_received': self._total_received,
|
||||
'time': self.loop.time()
|
||||
}
|
||||
|
||||
@@ -79,9 +73,6 @@ class ConnectionManager:
|
||||
) / (now - last)) / 1000000.0
|
||||
self._status['total_incoming_mbs'] = int(sum(list(self._status['incoming_bps'].values())
|
||||
) / (now - last)) / 1000000.0
|
||||
self._total_sent += sum(list(self._status['outgoing_bps'].values()))
|
||||
self._total_received += sum(list(self._status['incoming_bps'].values()))
|
||||
|
||||
self._status['time'] = now
|
||||
|
||||
def stop(self):
|
||||
@@ -93,9 +84,7 @@ class ConnectionManager:
|
||||
self.incoming.clear()
|
||||
self.incoming_connected.clear()
|
||||
self._status.clear()
|
||||
self._running = False
|
||||
|
||||
def start(self):
|
||||
self.stop()
|
||||
self._running = True
|
||||
self._task = self.loop.create_task(self._update())
|
||||