Quickstart

Download

macOS Linux Windows
Download v0.20.0 Download v0.20.0 Download v0.20.0

If you prefer to compile from source or are not on one of the above operating systems, follow this guide.

Run

Unzip and launch the daemon:

$lbrynet-daemon

While running, the daemon will provide a JSON-RPC interface on localhost. We'll learn how to interact with that next.

API Basics

When running, the LBRY daemon provides a JSON-RPC server running at http://localhost:5279.

It can be accessed by any utility capable of making HTTPS GET and POST requests, such as cURL or possibly your toaster. On Windows? You can also use PowerShell. Learn more.

To verify the LBRY daemon is running correctly, let's try looking up a URI:

$curl 'http://localhost:5279' --data '{"method":"resolve","params":{"uri":"what"}}' [ { "author": "Samuel Bryan", "content_type": "video/mp4", "description": "What is LBRY? An introduction with Alex Tabarrok", "language": "en", "license": "LBRY inc", "nsfw": false, "sources": { "lbry_sd_hash": "d5169241150022f996fa7cd6a9a1c421937276a3275eb912790bd07ba7aec1fac5fd45431d226b8fb402691e79aeb24b" }, "thumbnail": "https://s3.amazonaws.com/files.lbry.io/logo.png", "title": "What is LBRY?", "ver": "0.0.3" } ]

First Download

Above, we called the method resolve for the URL lbry://what. This returned the metadata associated with the URL.

Now let's download it. This time we're going to call the method get with the same parameters.

$curl 'http://localhost:5279' --data '{"method":"get","params":{"uri":"what"} }' [ { //some response fields omitted for brevity "claim_id": "7b670f0034d0eb119c32acfe8b19ae6622dd218f", //a claim ID is persistent for a piece of content. It stays the same if the original publisher updates the entry. "download_directory": "/home/kauffj/Downloads", "download_path": "/home/kauffj/Downloads/LBRY100.mp4", "file_name": "LBRY100.mp4", "metadata": { ... }, //same dictionary as above "outpoint": "6e224057a9dfa3417bb3890da2c4b4e9d2471641185c6c8b33cb57d61365a4f0:1", //an outpoint is a frozen-in-time pointer to a specific piece of content. It changes if the content changes. "total_bytes": 158433904, "written_bytes": 0 //will increase as the file downloads } ]

This file will download in the background to the download_directory specified in the returned data. Subsequent calls to get or file_list will return the status.

The LBRY API consists of about 50 calls, all related to discovering, distributing, and purchasing content. View the full API documentation.

You can also list all of the commands available by calling the help command.

$curl 'http://localhost:5279' --data '{"method":"help"}'

Windows

If you are running Windows and would like to follow this guide you could substitute curl with a PowerShell console and the following code.

$Invoke-RestMethod -Uri 'http://localhost:5279' -Body 'THE_JSON_DATA' -Method POST | ConvertTo-Json

If PowerShell does not work and you want to continue with cURL, you'll need to escape inner double quotes with a \ to pass the JSON properly via Command Prompt.

$curl "http://localhost:5279" --data "{\"method\":\"get\",\"params\":{\"uri\":\"what\"} }"

Credits

So far, everything we've done with LBRY has been free. However, some actions, such as reserving a name or purchasing paid content, require credits.

There are several ways to obtain credits. See this page for options. We also reward testers and contributors, so join our Discord Chat if you'd like to help.

To receive credits, you will need to generate a wallet address:

$curl 'http://localhost:5279' --data '{"method":"wallet_new_address"}' ["bbFxRyWCFRkA9YcuuZD8nE7XTLUxYnddTs"]

Once you have received or purchased some credits, confirm your balance by calling wallet_balance:

$curl 'http://localhost:5279' --data '{"method":"wallet_balance"}' [50.00000000]

Publishing

Publishing to LBRY is just as easy as everything else!

Not sure what to publish? We recommend your favorite picture or home video. Or just grab something from here.

$curl 'http://localhost:5279' --data '{"method":"publish", "params": { "name": "electricsheep", "file_path": "/home/kauffj/Desktop/electric-sheep.mp4", "bid": 1, "metadata": { "description": "Some interesting content", "title": "My interesting content", "author": "Video shot by me@example.com", "language": "en", "license": "LBRY Inc", "nsfw": false } //this should match the metadata returned by resolve_name }}' [ { "claim_id": "2081486f32dc493980c77bdaa0502950b532af13", "fee": 0.000329, "nout": 0, "tx": "0100000001a2dcee285b3f552fb8b3eef416c9f17...", "txid": "d71d63ebb3e10067bfd0b302433bc1ab09fbdd5dc9bc687f50aeb6809d1770fe" //this is the value you need to copy } ]

Enjoy a Hollywood Film

It's a Disaster starring David Cross is just one of tens of thousands of great pieces of content available. Check it out!

Note! This will cost you LBC. Run the resolve command to see the cost.

$curl 'http://localhost:5279' --data '{"method":"get","params":{"uri":"itsadisaster"} }' [ { //some response fields omitted for brevity "claim_id": "bd970a51249cba542a9acfb130147294a6326ee2", "download_directory": "/home/kauffj/Downloads", "download_path": "/home/kauffj/Downloads/It's A Disaster_Feature.mp4", "metadata": { "author": "Written and directed by Todd Berger", "content_type": "video/mp4", "description": "Four couples meet for Sunday brunch only to discover they are stuck in a house together as the world may be about to end." } } ]

Try the UI

LBRY comes with a fully-featured UI so that normal people can use it too. You can download it here.

You Did It! What's Next?

Start building something awesome! LBRY works as a discovery and distribution backend for everything from films to CAD files. View the full API documentation.

Join our Discord chat to interact with LBRY developers and other community members. Please visit the #dev room (note: this is not a default channel).

Visit our GitHub page to view the source code or report issues.