Merge pull request #163 from lbryio/launch

Launch-ish
This commit is contained in:
netop:// ウェッブ 2018-10-01 10:21:11 -05:00 committed by GitHub
commit 817f238ece
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
32 changed files with 376 additions and 320 deletions

View file

@ -37,7 +37,6 @@ function main() {
app.use(ssr());
app.route("/", page(require("./views/home")));
app.route("/api", page(require("./views/api")));
app.route("/api/*", page(require("./views/api")));
app.route("/*", page(require("./views/redirect")));

View file

@ -0,0 +1,15 @@
"use strict";
import html from "choo/html";
export default () => {
return html`
<div class="api__header page__markup">
<h1>lbrycrd APIs</h1>
<p>
Methods and signatures provided by the <a href="/glossary#lbrycrd">lbrycrd</a> blockchain daemon are documented below.
To build, download, or run lbrycrd, see the project <a href="https://github.com/lbryio/lbrycrd/blob/master/README.md">README</a>.
</p>
</div>
`;
};

View file

@ -0,0 +1,15 @@
"use strict";
import html from "choo/html";
export default () => {
return html`
<div class="api__header page__markup">
<h1>lbry-sdk APIs</h1>
<p>
Methods and signatures provided by the <a href="/glossary#lbry-sdk">lbry-sdk</a> daemon are documented below.
To build, download, or run the daemon, see the project <a href="https://github.com/lbryio/lbry/blob/master/README.md">README</a>.
</p>
</div>
`;
};

View file

@ -35,7 +35,7 @@ module.exports = exports = () => `
<h3>Additional Resources</h3>
<ul>
<li>See the <a href="https://lbry-whitepaper.herokuapp.comWhitepaper" title="">Whitepaper</a> for a more comprehensive introduction to the LBRY data network.</li>
<li>See the <a href="/whitepaper" title="">Whitepaper</a> for a more comprehensive introduction to the LBRY data network.</li>
<li>See <a href="/resources" title="">Resources</a> for documentation of the LBRY APIs.</li>
<li>See [[Whatever]] for learning more about LBRY distributes data.</li>
<li>See <a href="/build" title="">Build</a> for learning how to use the daemon to solve your own problem or build your own app!</li>

View file

@ -32,7 +32,7 @@ module.exports = exports = () => `
<h3>Additional Resources</h3>
<ul>
<li>See the <a href="https://lbry-whitepaper.herokuapp.com" title="Whitepaper">Whitepaper</a> for a more comprehensive introduction to the LBRY blockchain.</li>
<li>See the <a href="/whitepaper" title="Whitepaper">Whitepaper</a> for a more comprehensive introduction to the LBRY blockchain.</li>
<li>See the <a href="/resources" title="">Resources</a> for documentation about the LBRY blockchain, including its API.</li>
<li>See [[Naming]] for learning more about LBRY URLs and how they work.</li>
<li>See [[Identities]] for learning how the LBRY blockchain handles publisher identities.</li>

View file

@ -7,36 +7,32 @@
const links = [ // TODO: Update images
{
href: "https://chat.lbry.io",
image: "http://static.simpledesktops.com/static/images/sd-bg.png",
title: "Join us in chat"
},
{
href: "https://lbry.io/developer",
image: "http://static.simpledesktops.com/uploads/desktops/2017/02/28/GeoShapes_2880x1800.png",
title: "Join the developer email list"
},
{
href: "https://lbry.io/meet",
image: "http://static.simpledesktops.com/uploads/desktops/2016/12/05/Untitled-1-03-01.png",
title: "Host a meet-up"
title: "Chat (Discord)"
},
{
href: "https://discourse.lbry.io",
image: "http://static.simpledesktops.com/uploads/desktops/2017/02/28/GeoShapes_2880x1800.png",
title: "Developer Forum"
},
{
href: "https://lbry.fund",
image: "http://static.simpledesktops.com/uploads/desktops/2015/08/20/Sunset_by_Banned.png",
title: "lbry.fund (Project Funding)"
},
{
href: "https://www.reddit.com/r/lbry",
image: "http://static.simpledesktops.com/uploads/desktops/2016/08/28/Wind-Vector-resize.png",
title: "Reddit"
},
{
href: "https://lbry.fund",
image: "http://static.simpledesktops.com/uploads/desktops/2015/08/20/Sunset_by_Banned.png",
title: "Get funding for a project"
},
{
href: "https://lbry.io/join-us",
image: "http://static.simpledesktops.com/uploads/desktops/2015/09/25/Siri.png",
title: "Get a job"
title: "Join Our Team"
},
{
href: "https://twitter.com/lbryio",
image: "http://static.simpledesktops.com/static/images/sd-bg.png",
title: "Twitter"
}
];
@ -55,7 +51,7 @@ export default function () {
}
return `
<ul class="feature-links">${renderedLinks.join("")}</ul>
<div class="feature-links">${renderedLinks.join("")}</div>
`;
}
@ -65,14 +61,14 @@ export default function () {
function returnLinkTemplate(url, title, image) {
return `
<li class="feature-link">
<div>
<a class="feature-link__title" href="${url}" title="${title}">${title}</a>
</div>
<a class="feature-link" href="${url}" title="${title}">
<h3 class="feature-link__title">
<span class="feature-link__title-inner">${title}</span>
</h3>
<figure class="feature-link__background">
${image}
</figure>
</li>
</a>
`;
}

View file

@ -45,10 +45,9 @@ export default function (state) {
</li>
<li><a href="/overview" title="LBRY overview">Overview</a></li>
<li><a href="/playground" title="Play with LBRY">Playground</a></li>
<li><a href="/resources" title="View LBRY resources">Resources</a></li>
<li><a href="/contribute" title="Contribute to LBRY">Contribute</a></li>
<li><a href="/community" title="Interact with LBRY">Community</a></li>
<li><a href="/sitemap" title="">Sitemap</a></li>
<li><a href="/community" title="Hang with LBRY">Community</a></li>
</ul>
</div>
</footer>

View file

@ -39,16 +39,6 @@ export default class Navigation extends Nanocomponent {
title: "View LBRY resources",
url: "/resources"
},
{
name: "Contribute",
title: "Contribute to LBRY",
url: "/contribute"
},
{
name: "Build",
title: "View LBRY resources",
url: "/build"
},
{
name: "Community",
title: "Interact with LBRY",

View file

@ -0,0 +1,27 @@
"use strict";
import linkGrid from "./link-grid";
export default () => {
return linkGrid([{
title: "Whitepaper",
description: "Read the formal specification for LBRY.",
destination: "/whitepaper",
label: "Study the Paper"
}, {
title: "Contributor's Guide",
description: "Can you code, design, write or test? Join us!",
destination: "/contribute",
label: "Read the Guide"
}, {
title: "SDK APIs",
description: "Method signatures and examples for lbry-sdk, the most common way to build on LBRY.",
destination: "/api/sdk",
label: "SDK APIs"
}, {
title: "Blockchain APIs",
description: "Method signatures and examples for lbrycrd, the LBRY blockchain.",
destination: "/api/blockchain",
label: "Blockchain APIs"
}]);
};

9
app/data/redirects.json Normal file
View file

@ -0,0 +1,9 @@
{
"/tour" : "/playground",
"/play" : "/playground",
"/api" : "/resources",
"/api/protocol" : "/api/sdk",
"/api/lbry" : "/api/sdk",
"/api/lbrycrd" : "/api/blockchain",
"/whitepaper": "https://whitepaper.lbry.tech"
}

View file

@ -0,0 +1,15 @@
/*
this is fucking awful
*/
import Page404 from "../views/404.js";
import redirects from "../data/redirects.json";
export default (path) => {
const redirectUrl = redirects[path];
if (redirectUrl) {
throw "fix this please, needs to redirect to:" + redirectUrl;
} else {
return Page404();
}
};

View file

@ -15,29 +15,6 @@ body {
overflow-x: hidden;
position: relative;
z-index: 0;
&:not(.home) {
main > div:first-of-type {
flex: 1;
}
}
&.home {
@media (min-width: 1001px) {
main > div:first-of-type {
display: grid;
grid-gap: 0;
grid-template-areas:
"header header header"
"features features features"
"intro intro github"
"docs docs github"
"contribute contribute contribute"
"develop develop develop"
"community community community";
}
}
}
}
main {

View file

@ -119,6 +119,12 @@
top: -1px;
}
}
+ h2 {
margin-top: 2rem;
}
+ h3, + h4, + h5 {
margin-top: 1.5rem;
}
}
p,
@ -147,10 +153,6 @@
margin-bottom: 0.25rem;
}
}
+ h2, + h3, + h4, + h5 {
padding-top: 2rem;
}
}
ol {
@ -162,7 +164,16 @@
padding-left: 1.25rem;
}
img {
display: block;
margin-left: auto;
margin-right: auto;
margin-bottom: 1rem;
}
p {
margin-left: 2px;
margin-right: 2px;
img {
float: right;
}

View file

@ -6,7 +6,8 @@
*/
.__slate {
width: 100%; height: 100%;
width: 100%;
height: 100%;
position: relative;
&::after {
@ -14,6 +15,10 @@
}
}
.api__header
{
padding: 2rem;
}
/**
@ -34,7 +39,7 @@
.api__toc {
width: 200px; height: calc(100vh - 4rem); // navigation is 4rem tall
top: 4rem; left: 0; bottom: 0;
left: 0; bottom: 0;
background-color: $white;
border-right: 1px solid rgba($gray, 0.3);
@ -101,28 +106,14 @@
}
}
/**
* API | Main Content
*
* @class .api__content
* @class .api__content__body
* @class .api__content__body__arguments
*
* @class .api__content__body__argument
* @selector {::after}
* @selector {:last-of-type}
* @selector {:nth-child}
*
* @class .api__content__example
*/
.api__content {
display: grid;
float: right;
grid-template-columns: repeat(auto-fit, minmax(50%, 1fr));
width: calc(100% - 200px);
}
.api__documentation {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(50%, 1fr));
h1 {
font-size: 1.5rem;

View file

@ -1,3 +1,20 @@
body.home {
@media (min-width: 1001px) {
main > div:first-of-type {
display: grid;
grid-gap: 0;
grid-template-areas:
"header header header"
"features features features"
"intro intro github"
"docs docs github"
"contribute contribute contribute"
"develop develop develop"
"community community community";
}
}
}
.home {
padding-right: env(safe-area-inset-right);
padding-left: env(safe-area-inset-left);
@ -35,6 +52,7 @@
grid-area: header;
height: calc(50vh - 4rem); min-height: 300px;
justify-content: center;
margin-bottom: 2rem;
@media (max-width: 850px) {
background-size: cover;
@ -63,6 +81,7 @@
.features {
grid-area: features;
border-bottom: 1px solid rgba($black, 0.05);
}
.intro,
@ -104,6 +123,10 @@
}
}
ol, ul {
margin-bottom: 1.5rem;
}
p {
margin-bottom: 1.5rem;
max-width: 1000px;
@ -225,7 +248,7 @@
ul {
li {
@media (min-width: 701px) {
width: calc(100% / 5);
width: calc(100% / 4);
}
@media (max-width: 700px) {
@ -245,23 +268,19 @@
}
&:nth-child(1) a::before {
background-image: url("/assets/media/svg/flag.svg");
}
&:nth-child(2) a::before {
background-image: url("/assets/media/svg/keyboard.svg");
}
&:nth-child(3) a::before {
&:nth-child(2) a::before {
background-image: url("/assets/media/svg/anchor.svg");
}
&:nth-child(4) a::before {
background-image: url("/assets/media/svg/chat.svg");
&:nth-child(3) a::before {
background-image: url("/assets/media/svg/monitor.svg");
}
&:nth-child(5) a::before {
background-image: url("/assets/media/svg/monitor.svg");
&:nth-child(4) a::before {
background-image: url("/assets/media/svg/flag.svg");
}
}
}
@ -277,8 +296,7 @@
ul {
li {
@media (min-width: 701px) {
// width: calc(100% / 3); // https://github.com/lbryio/lbry.tech/issues/104
width: 50%; //
width: calc(100% / 3);
}
@media (max-width: 700px) {
@ -302,11 +320,11 @@
}
&:nth-child(2) a::before {
background-image: url("/assets/media/svg/reddit.svg");
background-image: url("/assets/media/svg/keyboard.svg");
}
&:nth-child(3) a::before {
background-image: url("/assets/media/svg/slack.svg");
background-image: url("/assets/media/svg/reddit.svg");
}
}
}

View file

@ -5,8 +5,6 @@
height: 100%;
}
.page__header-wrap {
width: 100%;
}

View file

@ -1,13 +1,17 @@
$width-feature-link: 320px;
.feature-links {
display: grid;
grid-gap: 2rem;
grid-template-columns: repeat(auto-fit, minmax(320px,1fr));
list-style-type: none;
padding-top: 0.5rem;
margin-bottom: 2rem;
}
.feature-link {
width: 320px; min-height: 135px;
width: $width-feature-link;
min-height: 135px;
background-color: $white;
border: 1px solid rgba($black, 0.1);
@ -18,15 +22,6 @@
transition: box-shadow 0.2s;
vertical-align: top;
> div:first-of-type {
top: 85px; left: 5%;
position: relative;
text-align: center;
width: 90%;
z-index: 1;
}
&:not(:hover) {
.feature-link__background {
filter: brightness(0.5);
@ -43,17 +38,23 @@
}
.feature-link__title {
position: relative;
top: 85px;
font-weight: normal;
text-align: center;
z-index: 1;
font-size: 1rem;
transition: color 0.2s;
}
.feature-link__title-inner {
display: inline-block;
padding: .25rem .5rem;
background-color: $white;
border: 1px solid rgba(gray, 0.1);
box-shadow: 0 2px 5px rgba($black, 0.025);
border-radius: 3px;
box-decoration-break: clone;
display: inline;
font-size: 1rem;
line-height: 1.7;
padding: 0.25rem 0.5rem;
transition: color 0.2s;
position: relative;
}
.feature-link__background {

View file

@ -1,17 +1,16 @@
.link-grid {
align-content: center;
border-bottom: 1px solid rgba($black, 0.05);
display: flex;
flex-flow: row wrap;
list-style-type: none;
padding-top: 2rem;
padding-bottom: 2rem;
}
.link-grid__link {
position: relative;
text-align: center;
vertical-align: top;
margin-bottom: 2rem;
flex-grow: 1;
@media (min-width: 651px) {
width: 50%;

26
app/views/404.js Normal file
View file

@ -0,0 +1,26 @@
"use strict";
import html from "choo/html";
export default () => {
return html`
<article class="page" itemtype="http://schema.org/BlogPosting">
<header class="page__header">
<div class="page__header-wrap">
<div class="inner-wrap">
<h1 class="page__header__title" itemprop="name headline">404</h1>
</div>
</div>
</header>
<section class="page__content page__markup" itemprop="articleBody">
<div class="inner-wrap">
<p>The requested page could not be found. Here is the image located at <a href="https://lbry.tech/playground">lbry://404</a> to console you.</p>
<img src="https://spee.ch/404.png" title="lbry://404" />
<p>Think something should be here? Let us know by <a href="/contribute#raising-issues">raising an issue</a>.</p>
</div>
</section>
</article>
`;
};

View file

@ -1,24 +1,13 @@
"use strict";
// P A C K A G E S
import asyncHtml from "choo-async/html";
import dedent from "dedent";
import fs from "graceful-fs";
import raw from "choo/html/raw";
import redirectOr404 from "../modules/redirectOr404";
import headerBlockchain from "../components/api/header-blockchain";
import headerSdk from "../components/api/header-sdk";
const fetch = require("make-fetch-happen").defaults({ cacheManager: "./cache" });
// V A R I A B L E
const apiScripts = "<script>" + fs.readFileSync("./app/components/client/api-scripts.js", "utf-8") + "</script>";
// E X P O R T
module.exports = exports = state => parseApiFile(state.params.wildcard).then(response => {
/*
state.lbry = {
@ -38,21 +27,37 @@ module.exports = exports = state => parseApiFile(state.params.wildcard).then(res
<ul class="api__toc__search__results"></ul>
</div>
<ul class="api__toc__items" id="toc" role="navigation">${raw(createApiSidebar(response).join(""))}</ul>
<ul class="api__toc__items" id="toc" role="navigation">${createApiSidebar(response)}</ul>
</aside>
<section class="api__content" id="toc-content">${raw(createApiContent(response).join(""))}</section>
<section class="api__content">
${createApiHeader(state.params.wildcard)}
<div class="api__documentation" id="toc-content">
${createApiContent(response)}
</div>
</section>
</div>
<script src="/assets/scripts/plugins/jets.js"></script>
${raw(apiScripts)}
<script src="/assets/scripts/api.js"></script>
`;
}).catch(() => {
redirectOr404(state.href);
});
// H E L P E R S
function createApiHeader(slug) {
switch (slug) {
case "sdk":
return headerSdk();
case "blockchain":
return headerBlockchain();
}
}
function createApiContent(apiDetails) {
const apiContent = [];
@ -99,9 +104,10 @@ function createApiSidebar(apiDetails) {
function parseApiFile(urlSlug) {
let apiFileLink;
if (!urlSlug || urlSlug === "api" || urlSlug === "protocol") apiFileLink = process.env.NODE_ENV === "development" ?
//checks below are related to rate limits, both URLs should return the same content
if (urlSlug === "sdk") apiFileLink = process.env.NODE_ENV === "development" ?
"https://rawgit.com/lbryio/lbry/master/docs/api.json" :
"https://cdn.rawgit.com/lbryio/lbry/5b3103e4/docs/api.json"
"https://cdn.rawgit.com/lbryio/lbry/master/docs/api.json"
;
if (urlSlug === "blockchain") apiFileLink = process.env.NODE_ENV === "development" ?
@ -109,7 +115,7 @@ function parseApiFile(urlSlug) {
"https://cdn.rawgit.com/lbryio/lbrycrd/add_api_docs_scripts/contrib/devtools/generated/api_v1.json"
;
if (!apiFileLink) return; // TODO: Error handling
if (!apiFileLink) return Promise.reject(new Error("Failed to fetch API docs")); // TODO: Error handling
return fetch(apiFileLink).then(() => fetch(apiFileLink, {
cache: "no-cache" // forces a conditional request

View file

@ -1,34 +1,8 @@
"use strict";
// P A C K A G E
import html from "choo/html";
// V A R I A B L E
import linkGrid from "../components/link-grid";
// E X P O R T
const featureLinks = linkGrid([
{
description: "Learn how LBRY works with 3 easy examples",
destination: "/playground",
label: "Jump into Playground",
title: "New to LBRY?"
},
{
description: "Help make LBRY better!",
destination: "/contribute",
label: "Explore our repos",
title: "Want to contribute?"
}
]);
module.exports = exports = () => html`
<div>
<section class="hero">
@ -41,26 +15,35 @@ module.exports = exports = () => html`
</section>
<section class="features">
${featureLinks}
${linkGrid([
{
description: "Get your head around LBRY with 3 interactive examples.",
destination: "/playground",
label: "Party in the Playground",
title: "Learn By Trying"
},
{
description: "Dig into the formal specification of the LBRY protocol.",
destination: "/whitepaper",
label: "Wisdom of the Whitepaper",
title: "Learn By Reading"
}
])}
</section>
<section class="intro">
<div class="inner-wrap">
<h3>Intro/Overview</h3>
<h3>Overview</h3>
<p>What if anyone in the world could publish a piece of digital content, anyone else in the world could access it, for free or for payment, and that entire system worked end-to-end without any centralized authority or point of control?</p>
<p>That's the idea behind LBRY. To create a market for accessing and publishing information that is global, decentralized, robust, optimal and complete.</p>
<a class="cta" href="/overview">Learn more about our mission</a>
<a class="cta" href="/overview">Observe the Overview</a>
</div>
</section>
<section class="docs">
<div class="inner-wrap">
<h3>Documentation</h3>
<p>LBRY has enough moving parts to warrant comprehensive documentation. Whether you are interested in learning the technical details of our technology stack or you want to integrate LBRY into your life, you will find everything you need in our docs.</p>
<a class="cta" href="/resources">Explore our documentation</a>
<h3>Resources</h3>
<p>Looking for API documentation, formal specifications, how-tos, resources, or the meaning of life? Find at least some of these things in the resources area.</p>
<a class="cta" href="/resources">Roam to Resources</a>
</div>
</section>
@ -72,34 +55,28 @@ module.exports = exports = () => html`
<section class="contribute">
<div class="inner-wrap">
<h3>Contribute</h3>
<p>Interested in progressing content freedom? Awesome! No matter your experience or skill level, <strong>you</strong> can make a difference.</p>
<p>No matter your experience or skill level, <em>you</em> can progress content freedom.</p>
<ul>
<li><a href="" title="">Raising Issues</a></li>
<li><a href="" title="">Coding</a></li>
<li><a href="" title="">Creative</a></li>
<li><a href="" title="">Translating</a></li>
<li><a href="" title="">Writing</a></li>
<li><a href="" title="">Testing</a></li>
</ul>
</div>
</section>
<section class="develop">
<div class="inner-wrap">
<h3>Development</h3>
<p>Like a bit of documentation but would prefer to jump in and make your mark on the blockchain? Perhaps add cats to it?</p>
<a class="cta" href="/api/protocol" title="Learn the LBRY API">Learn the LBRY API</a>
<p>
<a class="cta" href="/contribute">Collaborate with Contributors</a>
</p>
</div>
</section>
<section class="community">
<div class="inner-wrap">
<h3>Community</h3>
<p>Hang out with us! We have a vibrant community of lbryians and would be <em>delighted</em> if you joined us.</p>
<p>There's literally <a href="https://spee.ch/@lbrytech/dozens.mp4">12<sup>n</sup></a> of us.</p>
<ul>
<li><a href="//chat.lbry.io" title="LBRY on Discord">Discord</a></li>
<li><a href="//chat.lbry.io" title="LBRY on Discord">Chat</a></li>
<li><a href="//discourse.lbry.io" title="LBRY on Discourse">Forum</a></li>
<li><a href="//www.reddit.com/r/lbry" title="LBRY on Reddit">Reddit</a></li>
</ul>
</div>

View file

@ -11,6 +11,7 @@ import fs from "graceful-fs";
import html from "choo/html";
import path from "path";
import { require as local } from "app-root-path";
import redirectOr404 from "../modules/redirectOr404";
import raw from "choo/html/raw";
// V A R I A B L E S
@ -41,28 +42,11 @@ const md = require("markdown-it")({
module.exports = exports = (state, emit) => { // eslint-disable-line
let path;
if (state.route === "resources/*") path = `resources/${state.params.wildcard}`;
else path = state.params.wildcard;
if (!fs.existsSync(`./documents/${path}.md`)) {
return html`
<article class="page" itemtype="http://schema.org/BlogPosting">
<header class="page__header">
<div class="page__header-wrap">
<div class="inner-wrap">
<h1 class="page__header__title" itemprop="name headline">404</h1>
</div>
</div>
</header>
<section class="page__content page__markup" itemprop="articleBody">
<div class="inner-wrap">
<p>The page you are looking for does not exist.</p>
</div>
</section>
</article>
`;
return redirectOr404(state.href);
}
const markdownFile = fs.readFileSync(`./documents/${path}.md`, "utf-8");
@ -113,20 +97,18 @@ module.exports = exports = (state, emit) => { // eslint-disable-line
// H E L P E R S
function partialFinder(markdownBody) {
const regexToFindPartials = /<\w+\/>/g;
const regexToFindPartials = /<\w+ ?\/>/g;
const partials = markdownBody.match(regexToFindPartials);
if (!partials) return markdownBody;
for (const partial of partials) {
const filename = decamelize(partial, "-").replace("<", "").replace("/>", "");
const filename = decamelize(partial, "-").replace("<", "").replace("/>", "").trim();
const fileExistsTest = exists(`./app/components/${filename}.js`); // `local` results in error if used here and file !exist
if (!fileExistsTest) {
markdownBody = markdownBody.replace(partial, "");
}
else {
} else {
const partialFunction = require(path.join(__dirname, "..", `./components/${filename}.js`));
if (filename === "glossary-toc") markdownBody = markdownBody.replace(partial, partialFunction);
@ -140,12 +122,12 @@ function partialFinder(markdownBody) {
function wikiFinder(markdownBody) {
return markdownBody.replace(/\[\[([\w\s/-]+)\]\]/g, (match, p1) => {
const label = p1.trim(),
href = encodeURI("/glossary#" + label.replace(/\s+/g, '-'));
const label = p1.trim(),
href = encodeURI("/glossary#" + label.replace(/\s+/g, "-"));
return label ?
`<a href="${href}" class="link--glossary">${label}</a>` :
match.input;
}
return label ?
`<a href="${href}" class="link--glossary">${label}</a>` :
match.input;
}
);
}

View file

@ -4,6 +4,8 @@ title: Development
Want to build something on top of LBRY? This is the place to get you started.
# THIS IS NOT DONE AT ALL AND IF YOU CONTINUE TO READ IT YOU MENTALLY ASSENT TO COMMITTING AT LEAST ONE CHANGE THAT MAKES IT BETTER
At least, it's the place to get started so long as you have some idea of what LBRY _is_. If you don't, you should read the
[Overview](/overview) first.
@ -21,7 +23,7 @@ At least, it's the place to get started so long as you have some idea of what LB
### Web, Desktop, and Mobile Applications (Daemon-based Applications)
Almost all web, desktop, and mobile applications will use the [lbry daemon](https://github.com/lbryio/lbry) as a way of accessing and communicating with the LBRY network.
Almost all web, desktop, and mobile applications will use the [lbry-sdk](https://github.com/lbryio/lbry) as a way of accessing and communicating with the LBRY network.
#### Web Applications
@ -31,7 +33,7 @@ Almost all web, desktop, and mobile applications will use the [lbry daemon](http
#### Desktop Applications
1. Desktop applications will typically bundle the [lbry daemon](https://github.com/lbryio/lbry).
1. Desktop applications will typically use the [lbry-sdk](https://github.com/lbryio/lbry).
1. lbry-desktop as example
#### Android Applications

View file

@ -2,10 +2,12 @@
title: Community
---
Sometimes we say that the LBRY [[blockchain]] is the foundation of the LBRY protocol, but that's a lie.
Sometimes we say that the LBRY [[blockchain]] is the foundation of the LBRY protocol, but that's not really true. The foundation of LBRY is the community of people that make it possible.
The foundation of LBRY is the community of people that make it possible. LBRY uses computers to move bits around, but it's people that tell them how.
Get [upstream of consensus](https://spee.ch/d/consensus.png) by participating in the LBRY community.
## Commune Yourself
<FeatureLinks/>
<p>And don't forget to sign up for developer-only mailing list, below.</p>

View file

@ -1,43 +1,42 @@
---
title: Contributing
title: Contributor's Guide
---
## Contributing to LBRY
## Welcome to LBRY!
Interested in working on the LBRY protocol, an official LBRY app, or other LBRY infrastructure? Awesome! This guide will get you started.
This guide is for contributing to the code bases maintained by the LBRY organization. For building on top of the LBRY protocol, see [Build](/build).
This is a guide for contributing to the code bases maintained by the LBRY organization by [Coding](#coding), [Designing](#designing), [Writing](#writing), and [Testing](#testing).
Contributors that provide accepted pull requests, well-specified issues, or assist in testing and quality assurance typically receive LBC tokens as appreciation.
Contributors that provide accepted pull requests, well-specified issues, or assist in testing and quality assurance typically receive LBC tokens as [appreciation](#appreciation).
## Ecosystem Overview
Typical usage of LBRY does not involve a single piece of software, but several interacting components.
If you want to contribute to LBRY, the first step is to understand where.
If you want to contribute to LBRY, there's definitely something for you! The first step is to figure out what project to work on.
### Core Protocol Components
| Component | Language (Toolset) | What Is It
--- | --- | ---
| [lbrycrd](https://github.com/lbryio/lbrycrd) | C++ | A full node for the LBRY blockchain, including a standalone wallet. Used by miners and some applications. Most consumer applications do not bundle `lbrycrd` directly.
| [lbry](https://github.com/lbryio/lbry) | Python (Twisted) | A daemon that implements the LBRY protocol. Bundled with and/or used by most LBRY applications.
| [torba](https://github.com/lbryio/torba) | Python | The Simple Payment Verification (SPV) wallet bundled with `lbry`.
| [lbryumx](https://github.com/lbryio/lbryumx) | Protobuf, Python | The wallet server for the `lbryum` SPV wallet.
| [lbry-schema](https://github.com/lbryio/lbryschema) | Protobuf, Python | The structure of the metadata stored in the LBRY blockchain.
| [lbrycrd](https://github.com/lbryio/lbrycrd) | C++ | A full node for the LBRY blockchain, including a standalone wallet. Used by miners and some applications. Most consumer applications do not bundle [[lbrycrd]] directly, and instead bundle [[lbry-sdk]].
| [lbry-sdk](https://github.com/lbryio/lbry) | Python (Twisted) | A daemon that can be used directly or to develop other applications. Provides convenience [APIs](/api/sdk), bundles an SPV wallet ([[torba]]), and contains an implementation of the LBRY data network. |
| [torba](https://github.com/lbryio/torba) | Python | An [[SPV]] (Simple Payment Verification) wallet. Bundled with [[lbry-sdk]]. |
| [lbryumx](https://github.com/lbryio/lbryumx) | Protobuf, Python | The wallet server used by [[torba]].
| [lbry-schema](https://github.com/lbryio/lbryschema) | Protobuf, Python | Defines the structure of the metadata stored in the LBRY blockchain.
### Official Applications
| Application | Language (Toolset) | What Is It
--- | --- | ---
| [lbry-desktop](https://github.com/lbryio/lbry-desktop) | JavaScript (ReactJS, Electron) | A graphical browser for the LBRY protocol for Windows, macOS, and Linux. `lbry-desktop` bundles `lbry` and is primarily frontend code.
| [lbry-android](https://github.com/lbryio/lbry-desktop) | JavaScript (ReactNative), Python (kivy) | A graphical browser for the LBRY protocol for Android. `lbry-android` bundles `lbry` and is primarily frontend code.
| [lbry-redux](https://github.com/lbryio/lbry-redux) | JavaScript (Redux) | A common codebase for shared Redux logic between `lbry-desktop` and `lbry-android`.
| [lbry-desktop](https://github.com/lbryio/lbry-desktop) | JavaScript (ReactJS, Electron) | A graphical browser for the LBRY network for Windows, macOS, and Linux. [[lbry-desktop]] is built with [[lbry-sdk]]. |
| [lbry-android](https://github.com/lbryio/lbry-desktop) | JavaScript (ReactNative), Python (kivy) | A graphical browser for the LBRY network for Android. [[lbry-android]] is built with [[lbry-sdk]].
| [lbry-redux](https://github.com/lbryio/lbry-redux) | JavaScript (Redux) | A common codebase for shared Redux logic between [[lbry-desktop]] and [[lbry-android]].
| [spee.ch](https://github.com/lbryio/spee.ch) | JavaScript (Node, ReactJS, Express) | A web-based host for free LBRY content. Usable directly as a content link dump site or as a customized, standalone install.
### Websites
| Domain | Language (Toolset) | What Is It
--- | --- | ---
| [lbry.tech](https://github.com/lbryio/lbry.tech) | JavaScript (Vue, Vuepress) | You're on it.
| [lbry.tech](https://github.com/lbryio/lbry.tech) | JavaScript (Node, Choo) | You're on it.
| [lbry.io](https://github.com/lbryio/lbry.io) | PHP (vanilla) | A website for LBRY end-users and creators.
| [lbry.fund](https://github.com/lbryio/lbry.fund) | HTML | A website for receiving funding from LBRY, Inc.
@ -48,20 +47,18 @@ If you want to contribute to LBRY, the first step is to understand where.
| [lighthouse](https://github.com/lbryio/lighthouse) | JavaScript, ElasticSearch | A search service for the LBRY blockchain.
| [wunderbot](https://github.com/lbryio/lbry-wunderbot) | JavaScript (Node) | A chatbot used by the LBRY discord.
| [block-explorer](https://github.com/lbryio/block-explorer) | PHP (vanilla) | A blockchain explorer for the LBRY blockchain.
| Add more? other tipbots... |
## Coding
Several hundred extremely good-looking, intelligent and popular people, as well as our CTO, have contributed to LBRY. Join us!
Additionally, every technical employee of LBRY outside of the founding team started as a public contributor.
Several hundred extremely good-looking, wise and moral people, as well as our CTO, have contributed to LBRY. Join us!
### How To Contribute Code
1. **Identify the component you want to work on**. LBRY has code bases in Python, JavaScript, PHP, and C++. See [Ecosystem Overview](#ecosystem-overview).
1. **Get set up.** Each repo has a `README.md` with clear instructions on how to get the repo up and running properly. Thanks, [Repository Standards](/repository-standards)!
1. **Find something to work on**. All actively developed repositories should have issues tagged "Good First Issues" specifically for new contributors. Some projects use a "level: n" tagging system, where lower numbers are simpler and higher numbers are more complex. Of course, you are also welcome to work on something not currently filed if you have your own idea! Additionally, all repositories have contact information for the maintainer if you have trouble finding an issue to work on.
1. **Abide coding and commit standards**. Any specific information necessary to know in this regard should be in the `README`.
1. **Join the Community**. By joining our [chat](https://chat.lbry.io) or our [forum](https://discourse.lbry.io), you can interact with other developers when you have questions, ideas, or problems.
1. **Identify the component you want to work on**. LBRY has code bases that deal with everything from cryptography and distributed systems to end-user graphic user-interfaces. We use Python, JavaScript, C++, Go, and more. See [Ecosystem Overview](#ecosystem-overview) to find the right project.
1. **Get set up.** Each repo has a [[README]] with clear instructions on how to get the repo up and running properly. Thanks, [Repository Standards](/repository-standards)!
1. **Find something to work on**. All actively developed repositories should have issues tagged "Good First Issues" specifically for new contributors. You are also welcome to work on something not currently filed if you have your own idea. Additionally, all repositories have contact information for the maintainer if you have trouble finding an issue to work on.
1. **Abide coding and commit standards**. Any specific information necessary to know in this regard should be in the project [[README]].
1. **Commit early and ask questions**. Is an issue confusing? Please comment and say so! Not sure if you've got the right approach? Commit your code and we'll give feedback. Certain you're doing everything right? Commit it anyway. Once you commit, open a pull request. We encourage work-in-progress commits to let us know you're working on something and to facilitate feedback.
1. **Accept feedback and finish**. Most pull requests are reviewed within two business days. Once the repository maintainer has approved your contribution, it will get merged and we'll try really hard to give you LBC even if you say no.
@ -69,33 +66,37 @@ Additionally, every technical employee of LBRY outside of the founding team star
Web and application designers are requested to be able to work directly on CSS in the project they'd be contributing to. Please follow the [Coding](#coding) instructions for any website or application you want to improve.
We're happy to provide assistance if you're used to working in HTMl and CSS but are having trouble getting started. Check out [our chat](https://chat.lbry.io) or [our forum](https://discourse.lbry.io).
## Writing
Most written content at LBRY is checked into source control. To improve content we've written:
Most written content, and especially all technical writing, is checked into source control. To improve content we've written or add new content:
1. Identify which website or application it is in (see the [overview])(#ecosystem-overview).
1. Search for a quoted phrase of the content you want to change.
1. Search for a quoted phrase of the content you want to change (or use the same technique to identify the folder to create a new document in).
1. Edit the content via the GitHub interface and submit it as a pull request.
## Testing
If you want to contribute without getting directly into the code, one of the best ways you can contribute is testing.
A number of our code bases (`lbrycrd`, `lbry`, all applications, more...) go through regular release cycles where new versions are shipped every several weeks. Testing pre-release versions is a great way to help us identify issues and ship bug-free code.
A number of our code bases ([[lbrycrd]], [[lbry-sdk]], all applications, more...) go through regular release cycles where new versions are shipped every several weeks. Testing pre-release versions is a great way to help us identify issues and ship bug-free code.
For any projects that you want to be a tester on, "Watch" the repo on GitHub. You will receive an email with release notes whenever a release candidate is out.
### Ways to Test
For even harder-core testing, you can follow the `README` instructions in a project and test against the `master` branch of a project at any time. Additionally, `master` builds for some projects are always available via [build.lbry.io](http://build.lbry.io).
- "Watch" the repo on GitHub. You will receive an email with release notes whenever a release candidate is out and you can [raise an issue](#raising-issues).
- Join the #early-testing channel in our [chat](https://chat.lbry.io).
- For the hardcore, run master from source and/or the latest builds from [build.lbry.io](http://build.lbry.io).
Opening well-specified issues against release candidates or master builds is extremely useful in helping us create quality software.
**Note: that you perform testing at your own risk! If using release candidates and especially master builds, back up your wallet and be cautious.**
**Note: Please do not use wallets with substantial sums when testing. If using release candidates and especially master builds, back up your wallet and be cautious. While a substantial bug, like one that caused loss of funds, would merit significant [Appreciation](#appreciation), you perform testing at your own risk.**
## Raising Issues
If you're about to raise an issue because you've found a problem with LBRY, or you'd like to request a new feature, or for any other reason, please read this first.
All [bug reports](#reporting-a-bug) and [feature requests](#feature-requests) are managed through GitHub.
GitHub is the preferred channel for [bug reports](#reporting-a-bug) and [feature requests](#feature-requests).
If you're about to raise an issue because you've found a problem with LBRY, or you'd like to request a new feature, or for any other reason, please read this first.
### Reporting a Bug
@ -103,10 +104,10 @@ A bug is a _demonstrable problem_ that is caused by the code in the repository.
Guidelines for bug reports:
1. **Identify the correct repo**. See [ecosystem overview](#ecosystem-overview). While it's okay if you get this wrong, it's a big help to us if you get it right.
2. **Use the GitHub issue search** — check if the issue has already been reported (or fixed). Be sure to include closed tickets in your search.
3. **Follow the instructions** When you open an issue inside of GitHub, each repo contains a template for how to create a good bug report. Please follow it!
2. **Check if the issue exists**. Please do a quick search to see if the issue has been reported (or fixed), including closed tickets.
3. **Follow the instructions** - When you open an issue inside of GitHub, each repo contains a template for how to create a good bug report. Santa _loves_ people who follow it.
Well-specified bug reports save developers lots of time and are extremely appreciated, typically with an LBRY credit tip.
Well-specified bug reports save developers lots of time and are [appreciated](#appreciation).
### Feature Requests
@ -117,8 +118,14 @@ Feature requests are welcome. Before you submit one be sure to:
3. **Consider whether it's feasible** for us to tackle this feature in the next 6-12 months. The LBRY team is currently stretched thin just adding basic functionality. If this is a nice to have rather than a need, it is probably more clutter than helpful.
4. **Make a strong case** to convince the project's leaders of the merits of this feature. Please provide as much detail and context as possible. This means explaining the use case and why it is likely to be common.
## Tips
### Discussion and Help
We offer LBC as a thank you to anyone who contributes to LBRY. While we think we're fair-to-generous in our tips, tipping is more about recognizing and appreciating what you've given to the community than providing compensation.
Sometimes, you may have a problem but an issue isn't appropriate (or you're not sure if it's a real issue).
Join our [chat](https://chat.lbry.io), our [forum](https://discourse.lbry.io), or another [community](https://lbry.tech/community) and talk to others about it.
## Appreciation
We offer LBC as a gesture of our appreciation to anyone who contributes to LBRY. While we're generous in what we send, it is more about recognizing and appreciating what you've given to the community than providing compensation.
The amount of LBC is not typically specified in advance of a contribution, though if you're particularly motivated by this aspect you are welcome to ask.

View file

@ -136,9 +136,15 @@ The content price, set by the publisher, in order to download a claim. The key f
The currency code for 1 LBRY Credit (defined as 100 000 000 *deweys*).
### LBRYCrd
### lbrycrd
LBRYcrd uses a blockchain similar to bitcoin's to implement an index and payment system for content on the LBRY network. It is a fork of Core.
lbrycrd is the authoritative implementation of the LBRY [[blockchain]] protocol. See [the source code](https://github.com/lbryio/lbrycrd), [the API](/api/blockchain), or [the whitepaper](/whitepaper).
### lbry-sdk
An [[SDK]] for the LBRY protocol that can also be used independently. Distributed as a daemon or bundled directly, it contains a set of convenience methods for developing applications, and bundles an [[SPV]] wallet as well as implementation of the data network.
See [the source code](https://github/lbryio/lbry) or [the API documentation](/api/sdk).
### LBRY Credits
@ -252,6 +258,10 @@ Note that owning a very large amount of computational power does not override ot
A 2D point on an elliptic curve [secp256k1](https://en.bitcoin.it/wiki/Secp256k1) that is produced by multiplying a predefined "generator" point by a *private key*. Usually it is represented by a pair of 256-bit numbers ("uncompressed public key"), but can also be compressed to just one 256-bit number (at the slight expense of CPU time to decode an uncompressed number). A special hash of a public key is called *address*. Typical LBRY transactions contain public keys or addresses in the output scripts and *signatures* in the input scripts.
### README
A README is a file included in all code repositories that includes basic information about that project. More in (/resources/repository-standards).
### Reflector
A reflector cluster to accept LBRY content for hosting en masse, re-host the content, and make money on data fees (currently disabled). This code includes Go implementations of the LBRY peer protocol, reflector protocol, and DHT.
@ -272,6 +282,10 @@ Amount of newly generated LBRY credits that a *miner* may claim in a new block.
A compact turing-incomplete programming language used in transaction *inputs* and *outputs*. Scripts are interpreted by a Forth-like stack machine: each operation manipulates data on the stack. Most scripts follow the standard pattern and verify the digital *signature* provided in the transaction *input* against a *public key* provided in the previous transaction's *output*. Both signatures and public keys are provided using scripts. Scripts may contain complex conditions, but can never change amounts being transferred. Amount is stored in a separate field in a *transaction output*.
### SDK
An abbreviation for Software Development Kit. [[lbry-sdk]] is an SDK for developing applications that use the LBRY protocol.
### Secret key
Either the *Private Key* or an encryption key used in encrypted *wallets*. LBRY protocol does not use encryption anywhere, so *secret key* typically means a *private key* used for signing transactions.
@ -280,9 +294,9 @@ Either the *Private Key* or an encryption key used in encrypted *wallets*. LBRY
A sequence of bytes that proves that a piece of data is acknowledged by a person holding a certain *public key*. LBRY, like Bitcoin, uses *ECDSA* for signing transactions. Amounts of credits are sent through a chain of transactions: from one to another. Every transaction must provide a signature matching a public key defined in the previous transaction. This way only a proper owner of a secret *private key* associated with a given public key can spend credits further.
### Simplified Payment Verification (SPV)
### Simplified Payment Verification
A scheme to validate transactions without storing the whole blockchain (only block headers) and without trusting any external service. Every transaction must be present with all its parent and sibling hashes in a *merkle tree* up to the root. SPV client trusts the most *difficult* chain of block headers and can validate if the transaction indeed belongs to a certain block header. Since SPV does not validate all transactions, a *51% attack* may not only cause a *double spend* (like with *full nodes*), but also make a completely invalid payment with credits created from nowhere. However, this kind of attack is very costly and probably more expensive than a product in question.
A scheme to validate transactions without storing the whole blockchain (only block headers) and without trusting any external service. Every transaction must be present with all its parent and sibling hashes in a *merkle tree* up to the root. SPV client trusts the most *difficult* chain of block headers and can validate if the transaction indeed belongs to a certain block header. Since SPV does not validate all transactions, a *51% attack* may not only cause a *double spend* (like with *full nodes*), but also make a completely invalid payment with credits created from nowhere. However, this kind of attack is very costly and probably more expensive than a product in question. Frequently abbreviated as SPV.
### Soft Fork
@ -296,6 +310,10 @@ Incorrect peer-to-peer messages (like sending invalid transactions) may be consi
A transaction *output* can be spent only once: when another valid transaction makes a reference to this output from its own input. When another transaction attempts to spend the same output, it will be rejected by the nodes already seeing the first transaction. Blockchain as a *proof-of-work* scheme allows every node to agree on which transaction was indeed the first one. The whole transaction is considered spent when all its outputs are spent.
### SPV
SPV is an abbreviation for [[Simplified Payment Verification]].
### Stream
Streaming media is multimedia that is constantly received by and presented to an end-user while being delivered by a provider. In LBRY, streams as associated with claim data in order to provide the capability to download files over a Peer to Peer network.
@ -320,6 +338,10 @@ A 256-bit number that puts an upper limit for a block header hash to be valid. T
A set of parameters used for testing a LBRY network. Testnet is like *mainnet*, but has a different genesis block (it was reset several times, the latest testnet is *testnet3*). Testnet uses slightly different *address* format to avoid confusion with main LBRY addresses and all nodes are relaying and mining non-standard transactions.
### Torba
An [[SPV]] wallet for the LBRY [[blockchain]]. See the [source code](https://github.com/lbryio/torba).
### Transaction
A chunk of binary data that describes how credits are moved from one owner to another. Transactions are stored in the *[blockchain](#blockchain)*. Every transaction (except for *coinbase* transactions) has a reference to one or more previous transactions (*inputs*) and one or more rules on how to spend these credits further (*outputs*). See *Transaction Input* and *Transaction Output* for more info.

View file

@ -2,22 +2,18 @@
title: Resources
---
## Showcase
- [Whitepaper](https://lbry-whitepaper.herokuapp.com)
- [Blockchain API](/api/blockchain)
- [Protocol API](/api/protocol)
<ResourcesLinkGrid />
## Additional Resources
- [LBRY URIs](/resources/uri)
- [LBRY Claim Metadata Schema](/resources/schema)
- [LBRY Merkle Claim Trie](/resources/claimtrie)
- [LBRY Consensus Algorithm](/resources/consensus)
- [Download Overview](/resources/download-overview)
- [Lighthouse API](https://lbryio.github.io/lighthouse)
- [Merkle Claim Trie](/resources/claimtrie)
- [LBRY Claimtrie](/resources/lbry-claimtrie)
- [The LBRY Proof of Work (POW) Algorithm](/resources/pow)
- [Regtest Setup](/resources/regtest-setup)
- [Schema](/resources/schema)
- [Signing a claim](/resources/signing-claim)
- [URI](/resources/uri)
- [API Wrappers](/resources/api-wrappers)
- [LBRY Daemon Settings](/resources/daemon-settings)
- [Claim Signing](/resources/signing-claim)
- [Regtest Setup](/resources/regtest-setup)
- [Lighthouse (search) API](https://lbryio.github.io/lighthouse)

View file

@ -1,9 +1,10 @@
# The LBRY Proof of Work (POW) Algorithm
# LBRY Consensus Algorithm
LBRY uses [proof of work](https://en.bitcoin.it/wiki/Proof_of_work) the same way that Bitcoin does. The
only difference is the hash function. LBRY uses a slightly different algorithm that achieves the same ends but slightly delayed the development of a GPU miner and gave early adopters a chance to mine without specialized hardware.
LBRY uses [proof of work](https://en.bitcoin.it/wiki/Proof_of_work) as a consensus mechanism, the same way that Bitcoin does.
LBRY's algorithm is
LBRY has differences in hash function, block targeting, and difficult adjustment.
### Hash Mechanism
```python
intermediate = sha512(sha256(sha256(data))) # compute the sha512() of the double-sha256() of the data
@ -12,8 +13,10 @@ right = ripemd(intermediate[len(intermediate)/2:]) # and the right half
proof = sha256(sha256(left + right)) # concatenate the two halves, and double-sha256() it again
```
For comparison, Bitcoin's algorithm is...
### Block Targeting
```python
proof = sha256(sha256(data))
```
_PR this_.
### Difficulty Adjustment
_PR this_.

View file

@ -1,4 +1,4 @@
# Schema
# LBRY Claim Metadata Schema
The schema defines the structure of the data that is stored in claims in the LBRY blockchain. It has several goals:

View file

@ -1,27 +0,0 @@
---
title: Sitemap
---
- [/](/)
- [/api](/api)
- [/blockchain](/api/blockchain)
- [/protocol](/api/protocol)
- [/build](/build)
- [/community](/community)
- [/contribute](/contribute)
- [/glossary](/glossary)
- [/guides](/guides)
- [/css](/guides/css)
- [/js](/guides/js)
- [/overview](/overview)
- [/resources](/resources)
- [/claimtrie](/resources/claimtrie)
- [/encrypt-lbrycrd](/resources/encrypt-lbrycrd)
- [/lbry-claimtrie](/resources/lbry-claimtrie)
- [/pow](/resources/pow)
- [/regtest-setup](/resources/regtest-setup)
- [/repository-standards](/resources/repository-standards)
- [/schema](/resources/schema)
- [/signing-claim](/resources/signing-claim)
- [/uri](/resources/uri)
- [/tour](/tour)