midway thru many things

This commit is contained in:
Jeremy Kauffman 2018-09-30 13:34:29 -04:00
parent 031d2e347e
commit 26487ff4bd
16 changed files with 98 additions and 94 deletions

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

@ -8,15 +8,15 @@ export default () => {
description: "It's a white paper",
destination: "/whitepaper",
label: "Read"
}]) + linkGrid([ {
title: "LBRY SDK APIs",
description: "The LBRY SDK is the simplest way to start building with LBRY.",
destination: "/api/protocol",
label: "LBRY SDK API"
}, {
title: "Blockchain Docs",
description: "Learn how to talk to blockchain real good",
destination: "/api/blockchain",
label: "Blockchain API"
}, {
title: "LBRYnet docs",
description: "Learn wtf this is",
destination: "/api/protocol",
label: "SDK API LOL"
}]);
}

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

@ -6,7 +6,8 @@
*/
.__slate {
width: 100%; height: 100%;
width: 100%;
height: 100%;
position: relative;
&::after {
@ -14,6 +15,10 @@
}
}
.api__header
{
color: red;
}
/**
@ -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);

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);

View file

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

View file

@ -3,14 +3,15 @@
display: flex;
flex-flow: row wrap;
list-style-type: none;
padding-top: 2rem;
padding-bottom: 2rem;
margin-top: 2rem;
margin-bottom: 2rem;
}
.link-grid__link {
position: relative;
text-align: center;
vertical-align: top;
flex-grow: 1;
@media (min-width: 651px) {
width: 50%;

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

View file

@ -7,17 +7,31 @@
import asyncHtml from "choo-async/html";
import dedent from "dedent";
import fs from "graceful-fs";
import raw from "choo/html/raw";
const fetch = require("make-fetch-happen").defaults({ cacheManager: "./cache" });
// V A R I A B L E
/*
module.exports = exports = state => parseApiFile(state.params.wildcard).then(response => asyncHtml`
<div class="api__header">
I am a walrus.
</div>
<div class="__slate">
<aside class="api__toc">
<div class="api__toc__search">
<input class="api__toc__search__field" id="input-search" placeholder="Search" type="search"/>
<div class="api__toc__search__clear" id="clear-search" title="Clear search query">&times;</div>
<ul class="api__toc__search__results"></ul>
</div>
const apiScripts = "<script>" + fs.readFileSync("./app/components/client/api-scripts.js", "utf-8") + "</script>";
<ul class="api__toc__items" id="toc" role="navigation">${createApiSidebar(response)}</ul>
</aside>
// E X P O R T
<section class="api__content" id="toc-content">${createApiContent(response)}</section>
</div>
<script src="/assets/scripts/plugins/jets.js"></script>
<script src="/assets/scripts/api.js"></script>
`);
*/
module.exports = exports = state => parseApiFile(state.params.wildcard).then(response => {
/*
@ -51,6 +65,7 @@ module.exports = exports = state => parseApiFile(state.params.wildcard).then(res
// H E L P E R S
function createApiContent(apiDetails) {
@ -99,9 +114,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 +125,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,7 +15,20 @@ module.exports = exports = () => html`
</section>
<section class="features">
${featureLinks}
${linkGrid([
{
description: "Learn how LBRY works with 3 easy examples",
destination: "/tour",
label: "Take the Tour",
title: "New to LBRY?"
},
{
description: "Help make LBRY better!",
destination: "/contribute",
label: "Explore our repos",
title: "Want to contribute?"
}
])}
</section>
<section class="intro">

View file

@ -6,14 +6,14 @@ title: Resources
## 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:
@ -25,7 +25,7 @@ message Claim {
certificateType = 2;
}
required ClaimType claimType = 2;
optional Stream stream = 3;
optional Certificate certificate = 4;
optional Signature publisherSignature = 5;
@ -46,7 +46,7 @@ message Stream {
_0_0_1 = 1;
}
required Version version = 1;
required Metadata metadata = 2;
required Source source = 3;
}
@ -72,7 +72,7 @@ message Metadata {
en = 1;
}
required Language language = 2;
required string title = 3;
required string description = 4;
required string author = 5;
@ -80,7 +80,7 @@ message Metadata {
required bool nsfw = 7;
optional Fee fee = 8;
optional string thumbnail = 9;
optional string preview = 10;
optional string licenseUrl = 11;
@ -159,7 +159,7 @@ message Certificate {
_0_0_1 = 1;
}
required Version version = 1;
required KeyType keyType = 2;
required bytes publicKey = 4;
}
@ -177,7 +177,7 @@ message Signature {
_0_0_1 = 1;
}
required Version version = 1;
required KeyType signatureType = 2;
required bytes signature = 3;
required bytes certificateId = 4;