Added Resources page and changed link for APIs
This commit is contained in:
parent
08fd42d685
commit
60a44f471b
13 changed files with 59 additions and 135 deletions
|
@ -9,6 +9,7 @@ const bundles = require("choo-bundles");
|
||||||
const choo = require("choo");
|
const choo = require("choo");
|
||||||
const data = require("choo-data");
|
const data = require("choo-data");
|
||||||
const devtools = require("choo-devtools");
|
const devtools = require("choo-devtools");
|
||||||
|
const redirect = require("choo-redirect");
|
||||||
const ssr = require("choo-ssr");
|
const ssr = require("choo-ssr");
|
||||||
|
|
||||||
// V A R I A B L E S
|
// V A R I A B L E S
|
||||||
|
@ -45,9 +46,8 @@ function main() {
|
||||||
));
|
));
|
||||||
|
|
||||||
app.route("/", page(require("./views/pages/home")(app)));
|
app.route("/", page(require("./views/pages/home")(app)));
|
||||||
app.route("/api", page(require("./views/pages/api")(app)));
|
app.route("/api", redirect("/api/blockchain")); // This doesn't seem to work...
|
||||||
app.route("/resources", page(require("./views/pages/resources")(app)));
|
app.route("/api/*", page(require("./views/pages/api")(app)));
|
||||||
app.route("/resources/*", page(require("./views/pages/page")(app)));
|
|
||||||
app.route("/*", page(require("./views/pages/page")(app)));
|
app.route("/*", page(require("./views/pages/page")(app)));
|
||||||
|
|
||||||
return app;
|
return app;
|
||||||
|
|
20
documents/resources.md
Normal file
20
documents/resources.md
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
---
|
||||||
|
title: Resources
|
||||||
|
---
|
||||||
|
|
||||||
|
## Showcase
|
||||||
|
|
||||||
|
- [Whitepaper](https://lbry-whitepaper.herokuapp.com)
|
||||||
|
- [Blockchain API](/api/blockchain)
|
||||||
|
- [Daemon API](/api/daemon)
|
||||||
|
|
||||||
|
## Additional Resources
|
||||||
|
|
||||||
|
- [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)
|
|
@ -1,5 +1,4 @@
|
||||||
The Merkle Claim Trie
|
# The Merkle Claim Trie
|
||||||
==============
|
|
||||||
|
|
||||||
How the data structure that organizes claims by names works, how proofs are generated/verified and how consensus on the state of the trie is represented.
|
How the data structure that organizes claims by names works, how proofs are generated/verified and how consensus on the state of the trie is represented.
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
## Introduction
|
# LBRY Claimtrie
|
||||||
|
|
||||||
This document describes the implementation detail of the ClaimTrie in LBRY. The ClaimTrie is the data structure which LBRY uses to store claims to names. It uses a [Trie](https://en.wikipedia.org/wiki/Trie) to efficiently store all claimed names, which can then be hashed the same way a [Merkle Tree](https://en.wikipedia.org/wiki/Merkle_tree) is hashed. The root hash of the ClaimTrie is stored in the blockheader of each LBRY block, enabling nodes in the LBRY network to efficiently and securely validate the state of the ClaimTrie.
|
This document describes the implementation detail of the ClaimTrie in LBRY. The ClaimTrie is the data structure which LBRY uses to store claims to names. It uses a [Trie](https://en.wikipedia.org/wiki/Trie) to efficiently store all claimed names, which can then be hashed the same way a [Merkle Tree](https://en.wikipedia.org/wiki/Merkle_tree) is hashed. The root hash of the ClaimTrie is stored in the blockheader of each LBRY block, enabling nodes in the LBRY network to efficiently and securely validate the state of the ClaimTrie.
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
## The LBRY Proof of Work (POW) Algorithm
|
# The LBRY Proof of Work (POW) Algorithm
|
||||||
|
|
||||||
LBRY uses [proof of work](https://en.bitcoin.it/wiki/Proof_of_work) the same way that Bitcoin does. The
|
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.
|
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.
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# Regtest Setup
|
||||||
|
|
||||||
## Why use a regtest server
|
## Why use a regtest server
|
||||||
A regtest server provides for a way to instantly generate blocks so that transactions can be instantaneous, so ultimately no waiting for confirmations from the blockchain. Also, no problem if you accidentally corrupt your wallet, since no real funds are lost! Delete the files and setup a new one.
|
A regtest server provides for a way to instantly generate blocks so that transactions can be instantaneous, so ultimately no waiting for confirmations from the blockchain. Also, no problem if you accidentally corrupt your wallet, since no real funds are lost! Delete the files and setup a new one.
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# Schema
|
||||||
|
|
||||||
## [Claim](https://github.com/lbryio/lbryschema/blob/master/lbryschema/proto/claim.proto)
|
## [Claim](https://github.com/lbryio/lbryschema/blob/master/lbryschema/proto/claim.proto)
|
||||||
Claims have the encompassing schema:
|
Claims have the encompassing schema:
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
### Signing a claim
|
# Signing a claim
|
||||||
|
|
||||||
Reilly wants to publish _Terror on the Midway_ to the channel he claimed `lbry://@FleischerSuperman`. He picks the name "terroronthemidway", and fills in the information for the claim:
|
Reilly wants to publish _Terror on the Midway_ to the channel he claimed `lbry://@FleischerSuperman`. He picks the name "terroronthemidway", and fills in the information for the claim:
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,8 @@
|
||||||
//this doc has been moved to lbry.tech repo, will clean up later.
|
|
||||||
# URI
|
# URI
|
||||||
|
|
||||||
## Regex
|
## Regex
|
||||||
|
|
||||||
If you are a robot and prefer regexes to English, here's the full regex for lbry:// URIs:
|
If you are a robot and prefer regexes to English, here's the full regex for `lbry://` URIs:
|
||||||
|
|
||||||
```
|
```
|
||||||
(?P<uri>
|
(?P<uri>
|
||||||
|
@ -32,12 +31,12 @@ The LBRY protocol is called `lbry`. URIs using the protocol must start with `lbr
|
||||||
|
|
||||||
## Reserved characters
|
## Reserved characters
|
||||||
|
|
||||||
- CHANNEL_CHAR = '@'
|
- CHANNEL_CHAR = `@`
|
||||||
- CLAIM_ID_CHAR = '#'
|
- CLAIM_ID_CHAR = `#`
|
||||||
- CLAIM_SEQUENCE_CHAR = ':'
|
- CLAIM_SEQUENCE_CHAR = `:`
|
||||||
- BID_POSITION_CHAR = '$'
|
- BID_POSITION_CHAR = `$`
|
||||||
- PATH_CHAR = '/'
|
- PATH_CHAR = `/`
|
||||||
- QUERY_CHAR = '?'
|
- QUERY_CHAR = `?`
|
||||||
|
|
||||||
## Names
|
## Names
|
||||||
|
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
"choo-async": "^0.1.1",
|
"choo-async": "^0.1.1",
|
||||||
"choo-bundles": "^0.2.4",
|
"choo-bundles": "^0.2.4",
|
||||||
"choo-data": "^0.1.1",
|
"choo-data": "^0.1.1",
|
||||||
|
"choo-redirect": "^2.0.0",
|
||||||
"choo-ssr": "^0.2.1",
|
"choo-ssr": "^0.2.1",
|
||||||
"choo-websocket": "^2.0.0",
|
"choo-websocket": "^2.0.0",
|
||||||
"cors": "^2.8.4",
|
"cors": "^2.8.4",
|
||||||
|
|
|
@ -12,18 +12,13 @@ const raw = require("nanohtml/raw");
|
||||||
|
|
||||||
// V A R I A B L E
|
// V A R I A B L E
|
||||||
|
|
||||||
const 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"
|
|
||||||
;
|
|
||||||
|
|
||||||
const apiScripts = "<script>" + fs.readFileSync("./views/partials/api-scripts.js", "utf-8") + "</script>";
|
const apiScripts = "<script>" + fs.readFileSync("./views/partials/api-scripts.js", "utf-8") + "</script>";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// E X P O R T
|
// E X P O R T
|
||||||
|
|
||||||
module.exports = exports = () => async () => parseApiFile().then(response => html`
|
module.exports = exports = () => async state => parseApiFile(state.params.wildcard).then(response => html`
|
||||||
<div class="__slate">
|
<div class="__slate">
|
||||||
<aside class="api__toc">
|
<aside class="api__toc">
|
||||||
<div class="api__toc__search">
|
<div class="api__toc__search">
|
||||||
|
@ -49,6 +44,8 @@ function createApiContent(apiDetails) {
|
||||||
const apiContent = [];
|
const apiContent = [];
|
||||||
|
|
||||||
for (const apiDetail of apiDetails) {
|
for (const apiDetail of apiDetails) {
|
||||||
|
// console.log(apiDetail);
|
||||||
|
// console.log("—————");
|
||||||
const apiDetailsReturns = JSON.parse(JSON.stringify(apiDetail.returns));
|
const apiDetailsReturns = JSON.parse(JSON.stringify(apiDetail.returns));
|
||||||
|
|
||||||
apiContent.push(`
|
apiContent.push(`
|
||||||
|
@ -87,7 +84,21 @@ function createApiSidebar(apiDetails) {
|
||||||
return apiSidebar;
|
return apiSidebar;
|
||||||
}
|
}
|
||||||
|
|
||||||
function parseApiFile() {
|
function parseApiFile(urlSlug) {
|
||||||
|
let apiFileLink;
|
||||||
|
|
||||||
|
if (urlSlug === "blockchain") 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"
|
||||||
|
;
|
||||||
|
|
||||||
|
if (urlSlug === "daemon") apiFileLink = process.env.NODE_ENV === "development" ?
|
||||||
|
"https://rawgit.com/lbryio/lbrycrd/add_api_docs_scripts/contrib/devtools/generated/api_v1.json" :
|
||||||
|
"https://cdn.rawgit.com/lbryio/lbrycrd/add_api_docs_scripts/contrib/devtools/generated/api_v1.json"
|
||||||
|
;
|
||||||
|
|
||||||
|
if (!apiFileLink) return; // TODO: Error handling
|
||||||
|
|
||||||
return fetch(apiFileLink).then(() => fetch(apiFileLink, {
|
return fetch(apiFileLink).then(() => fetch(apiFileLink, {
|
||||||
cache: "no-cache" // forces a conditional request
|
cache: "no-cache" // forces a conditional request
|
||||||
})).then(res => res.json().then(body => body)); // res.status 304 = cache validated
|
})).then(res => res.json().then(body => body)); // res.status 304 = cache validated
|
||||||
|
|
|
@ -82,7 +82,7 @@ module.exports = exports = () => async () => html`
|
||||||
<h3>Development</h3>
|
<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>
|
<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" title="Learn the LBRY API">Learn the LBRY API</a>
|
<a class="cta" href="/api/blockchain" title="Learn the LBRY API">Learn the LBRY API</a>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
|
|
|
@ -1,110 +0,0 @@
|
||||||
"use strict";
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// P A C K A G E
|
|
||||||
|
|
||||||
const html = require("choo-async/html");
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// E X P O R T
|
|
||||||
|
|
||||||
module.exports = exports = () => async () => 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">Resources</h1>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</header>
|
|
||||||
|
|
||||||
<section class="page__content" itemprop="articleBody">
|
|
||||||
<div class="inner-wrap">
|
|
||||||
<h2>Whitepaper</h2>
|
|
||||||
<h4>LBRY: A Decentralized Digital Content Marketplace</h4>
|
|
||||||
<p>Some info here about the whitepaper and <a href="/whitepaper.html">a link</a>.</p>
|
|
||||||
|
|
||||||
<h2>API Specification</h2>
|
|
||||||
<h4>All of our APIs, in one place</h4>
|
|
||||||
|
|
||||||
<h3>chainquery</h3>
|
|
||||||
<ul>
|
|
||||||
<li><a href="https://github.com/lbryio/chainquery">Codebase</a></li>
|
|
||||||
<li><a href="">OpenAPI signature</a></li>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
<h3>lbry</h3>
|
|
||||||
<ul>
|
|
||||||
<li><a href="https://lbry.io/api">Codebase</a></li>
|
|
||||||
<li><a href="/resources/lbry.html">OpenAPI signature</a></li>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
<h3>lbrycrd</h3>
|
|
||||||
<ul>
|
|
||||||
<li><a href="https://github.com/lbryio/lbrycrd">Codebase</a></li>
|
|
||||||
<li><a href="/resources/lbrycrd.html">OpenAPI signature</a></li>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
<h3>Lighthouse</h3>
|
|
||||||
<ul>
|
|
||||||
<li><a href="https://lbryio.github.io/lighthouse">Codebase</a></li>
|
|
||||||
<li><a href="">OpenAPI signature</a></li>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
<h2>The Front Desk</h2>
|
|
||||||
<h4>Latest news and musings from the LBRY team</h4>
|
|
||||||
|
|
||||||
<ul class="blog-posts">
|
|
||||||
<li class="blog-post">
|
|
||||||
<a class="blog-post__title" href="https://lbry.io/news/we-are-hiring-our-boss">We're Hiring Our Boss</a>
|
|
||||||
<div class="blog-post__meta">
|
|
||||||
<span class="blog-post__meta__date">2018/05/11</span>
|
|
||||||
<span class="blog-post__meta__author">Samuel Bryan</span>
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
|
|
||||||
<li class="blog-post">
|
|
||||||
<a class="blog-post__title" href="https://lbry.io/news/lbry-development-community-update-apr-2018">Development and Community Update April 2018</a>
|
|
||||||
<div class="blog-post__meta">
|
|
||||||
<span class="blog-post__meta__date">2018/05/04</span>
|
|
||||||
<span class="blog-post__meta__author">Samuel Bryan</span>
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
|
|
||||||
<li class="blog-post">
|
|
||||||
<a class="blog-post__title" href="https://lbry.io/news/imineblocks">Hey, mine your own business!</a>
|
|
||||||
<div class="blog-post__meta">
|
|
||||||
<span class="blog-post__meta__date">2018/04/05</span>
|
|
||||||
<span class="blog-post__meta__author">Reilly Smith</span>
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
|
|
||||||
<li class="blog-post">
|
|
||||||
<a class="blog-post__title" href="https://lbry.io/news/lbry-development-community-update-mar-2018">Development and Community Update March 2018</a>
|
|
||||||
<div class="blog-post__meta">
|
|
||||||
<span class="blog-post__meta__date">2018/04/03</span>
|
|
||||||
<span class="blog-post__meta__author">Tom Zarebczan</span>
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
|
|
||||||
<li class="blog-post">
|
|
||||||
<a class="blog-post__title" href="https://lbry.io/news/if-you-still-havent-found-what-youre-searching-for">If you still haven't found what you're searching for...</a>
|
|
||||||
<div class="blog-post__meta">
|
|
||||||
<span class="blog-post__meta__date">2018/03/22</span>
|
|
||||||
<span class="blog-post__meta__author">Brinck Slattery</span>
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</section>
|
|
||||||
</article>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
// TODO: make this happen in components/layout
|
|
||||||
document.getElementsByTagName("body")[0].classList.add("resources"); // documentation
|
|
||||||
</script>
|
|
||||||
`;
|
|
||||||
|
|
||||||
// TODO: Make blog post section dynamic. It should be grabbing the latest posts automatically
|
|
Loading…
Add table
Reference in a new issue