From 60a44f471bd9e59590ed6bb23bc175d9fe966433 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=83=9D=E3=83=BC=E3=83=AB=20=E3=82=A6=E3=82=A7=E3=83=83?= =?UTF-8?q?=E3=83=96?= Date: Thu, 23 Aug 2018 17:33:59 -0500 Subject: [PATCH] Added Resources page and changed link for APIs --- client.js | 6 +- documents/resources.md | 20 +++++ documents/resources/claimtrie.md | 3 +- documents/resources/lbry-claimtrie.md | 4 +- documents/resources/pow.md | 2 +- documents/resources/regtest-setup.md | 2 + documents/resources/schema.md | 2 + documents/resources/signing-claim.md | 2 +- documents/resources/uri.md | 15 ++-- package.json | 1 + views/pages/api.js | 25 ++++-- views/pages/home.js | 2 +- views/pages/resources.js | 110 -------------------------- 13 files changed, 59 insertions(+), 135 deletions(-) create mode 100644 documents/resources.md delete mode 100644 views/pages/resources.js diff --git a/client.js b/client.js index 3cb37d1..976956c 100755 --- a/client.js +++ b/client.js @@ -9,6 +9,7 @@ const bundles = require("choo-bundles"); const choo = require("choo"); const data = require("choo-data"); const devtools = require("choo-devtools"); +const redirect = require("choo-redirect"); const ssr = require("choo-ssr"); // 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("/api", page(require("./views/pages/api")(app))); - app.route("/resources", page(require("./views/pages/resources")(app))); - app.route("/resources/*", page(require("./views/pages/page")(app))); + app.route("/api", redirect("/api/blockchain")); // This doesn't seem to work... + app.route("/api/*", page(require("./views/pages/api")(app))); app.route("/*", page(require("./views/pages/page")(app))); return app; diff --git a/documents/resources.md b/documents/resources.md new file mode 100644 index 0000000..79b5741 --- /dev/null +++ b/documents/resources.md @@ -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) diff --git a/documents/resources/claimtrie.md b/documents/resources/claimtrie.md index 8ceec1d..674f8dd 100644 --- a/documents/resources/claimtrie.md +++ b/documents/resources/claimtrie.md @@ -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. diff --git a/documents/resources/lbry-claimtrie.md b/documents/resources/lbry-claimtrie.md index 3b11f29..8ed4398 100644 --- a/documents/resources/lbry-claimtrie.md +++ b/documents/resources/lbry-claimtrie.md @@ -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. @@ -13,7 +13,7 @@ There are also three different bid types: claim, update, and support. 1. *Claim*: A claim represent new bids for a name. If a user wants to make a claim to a brand new name, or submit a competing claim to an existing name, this bid type is used. 2. *Support*: A support adds to the total quantity of credits assigned to any bid by referring to a bid's Claim Id. A support bid can be made by anyone on any bid. It does not have its own Value or its own Claim Id, but it does contain the Claim Id of the bid that it is supporting. -3. *Update*: An update can modify the value and the quantity for a pre-existing claim without changing the Claim Id or the name that it is bidding on. Since the Claim Id of the original bid is not changed, an updated bid will still retain all the supports attached to the original bid. +3. *Update*: An update can modify the value and the quantity for a pre-existing claim without changing the Claim Id or the name that it is bidding on. Since the Claim Id of the original bid is not changed, an updated bid will still retain all the supports attached to the original bid. ## ClaimTrie Bid States diff --git a/documents/resources/pow.md b/documents/resources/pow.md index b83d459..cee5d8e 100644 --- a/documents/resources/pow.md +++ b/documents/resources/pow.md @@ -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 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. diff --git a/documents/resources/regtest-setup.md b/documents/resources/regtest-setup.md index bf2571a..d9213cb 100644 --- a/documents/resources/regtest-setup.md +++ b/documents/resources/regtest-setup.md @@ -1,3 +1,5 @@ +# Regtest Setup + ## 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. diff --git a/documents/resources/schema.md b/documents/resources/schema.md index b6dfa4c..34ea56f 100644 --- a/documents/resources/schema.md +++ b/documents/resources/schema.md @@ -1,3 +1,5 @@ +# Schema + ## [Claim](https://github.com/lbryio/lbryschema/blob/master/lbryschema/proto/claim.proto) Claims have the encompassing schema: diff --git a/documents/resources/signing-claim.md b/documents/resources/signing-claim.md index 6ca2124..5b5aa6c 100644 --- a/documents/resources/signing-claim.md +++ b/documents/resources/signing-claim.md @@ -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: diff --git a/documents/resources/uri.md b/documents/resources/uri.md index 511aa0b..998d484 100644 --- a/documents/resources/uri.md +++ b/documents/resources/uri.md @@ -1,9 +1,8 @@ -//this doc has been moved to lbry.tech repo, will clean up later. # URI ## 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 @@ -32,12 +31,12 @@ The LBRY protocol is called `lbry`. URIs using the protocol must start with `lbr ## Reserved characters -- CHANNEL_CHAR = '@' -- CLAIM_ID_CHAR = '#' -- CLAIM_SEQUENCE_CHAR = ':' -- BID_POSITION_CHAR = '$' -- PATH_CHAR = '/' -- QUERY_CHAR = '?' +- CHANNEL_CHAR = `@` +- CLAIM_ID_CHAR = `#` +- CLAIM_SEQUENCE_CHAR = `:` +- BID_POSITION_CHAR = `$` +- PATH_CHAR = `/` +- QUERY_CHAR = `?` ## Names diff --git a/package.json b/package.json index 4186a70..d769a48 100755 --- a/package.json +++ b/package.json @@ -14,6 +14,7 @@ "choo-async": "^0.1.1", "choo-bundles": "^0.2.4", "choo-data": "^0.1.1", + "choo-redirect": "^2.0.0", "choo-ssr": "^0.2.1", "choo-websocket": "^2.0.0", "cors": "^2.8.4", diff --git a/views/pages/api.js b/views/pages/api.js index 578e472..3fd842e 100644 --- a/views/pages/api.js +++ b/views/pages/api.js @@ -12,18 +12,13 @@ const raw = require("nanohtml/raw"); // 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 = ""; // 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`