Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: update protocol-reference.md #51

Open
wants to merge 401 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
401 commits
Select commit Hold shift + click to select a range
fca7e8d
chore: update build files
mistakia May 22, 2021
12ddfd3
docs: update protocol-reference.md
mistakia May 22, 2021
f86c6cf
docs: update protocol-reference.md
mistakia May 22, 2021
6baa66e
docs: update protocol-reference.md
mistakia May 22, 2021
c772958
docs: update history.md
mistakia May 22, 2021
25ec5ac
fix: typo
mistakia May 22, 2021
2e2afdc
docs: update protocol-reference.md
mistakia May 22, 2021
b03d641
docs: update protocol-reference.md
mistakia May 22, 2021
947d494
docs: update protocol-reference.md
mistakia May 22, 2021
c66fc96
docs: update protocol-reference.md
mistakia May 23, 2021
fcb79cc
docs: update protocol-reference.md
mistakia May 23, 2021
2c069e2
docs: update protocol-reference.md
mistakia May 23, 2021
f0ead5a
docs: update protocol-reference.md
mistakia May 24, 2021
4d453b1
feat: import discord messages
mistakia May 24, 2021
1b9a4b9
fix: twitter summary card preview
mistakia May 24, 2021
bc85f8f
fix: twitter summary card preview
mistakia May 24, 2021
1a8bf92
fix: discord default score is 1
mistakia May 24, 2021
561f2f9
fix: source avg score calculation
mistakia May 24, 2021
a9f3fa9
fix: discord message score
mistakia May 24, 2021
43e77df
fix: add twitter card meta tags
mistakia May 24, 2021
c5fae70
fix: minimum score
mistakia May 24, 2021
001f77b
feat: show github events
mistakia May 25, 2021
286468e
chore: fix schema
mistakia May 25, 2021
679b23d
style: doc contributor section
mistakia May 25, 2021
868547c
fix: exclude discord general channel
mistakia May 25, 2021
e321d73
debug: twitter card
mistakia May 25, 2021
110578c
fix: remove duplicates from trending
mistakia May 25, 2021
a44a00a
docs: update attack-vectors.md
mistakia May 25, 2021
9d3bdb0
feat: show announcments for last 3d
mistakia May 25, 2021
d8f07f4
Update basics.md (#12)
SenatusSPQR May 25, 2021
1c97d03
create: add glossary page to learn section (#14)
mistakia May 25, 2021
e8acad6
chore: update build
mistakia May 25, 2021
d9efff5
Update basics.md (#13)
SenatusSPQR May 25, 2021
c6af91f
chore: cleanup
mistakia May 25, 2021
8813d93
feat: add nakamoto coefficient & prin rep count
mistakia May 26, 2021
b37a36d
fix: empty announcements
mistakia May 26, 2021
0f6a53a
feat: add links to headers
mistakia May 26, 2021
640e80d
fix: location change hash bug
mistakia May 27, 2021
c173bc3
docs: updated getting-started-users/basics.md
mistakia May 27, 2021
a231530
debug: twitter social tags
mistakia May 27, 2021
f1a8eee
docs: updated best-practices & storing
mistakia May 27, 2021
107d417
docs: update attack-vectors.md
mistakia May 26, 2021
344ba62
docs: update security, attack-vectors, challenges
mistakia May 27, 2021
dee8499
feat: add accounts api endpoint
mistakia May 21, 2021
132a52e
chore: script template
mistakia May 29, 2021
070c7c0
docs: update protocol-reference.md (cc keeri & drew)
mistakia May 29, 2021
a700af0
feat: add representatives
mistakia May 29, 2021
efcea88
docs: update protocol-reference.md
mistakia May 29, 2021
a73f5f3
chore: update import-representatives
mistakia May 30, 2021
af13b40
docs: update attack-vectors
mistakia May 30, 2021
1fc51b4
docs: update protocol-reference
mistakia May 30, 2021
4fd875b
feat: import representatives meta
mistakia May 30, 2021
8913a54
feat: add representatives api endpoint
mistakia May 30, 2021
d9e5c8d
feat: add energy usage to network stats
mistakia May 30, 2021
9afd4c7
fix: update network tooltip descriptions
mistakia May 31, 2021
9428a30
feat: increase cache ttl
mistakia May 31, 2021
a763115
chore: mysql backups
mistakia May 31, 2021
f3de139
chore: update mysql backup script
mistakia May 31, 2021
6697013
chore: update db schema
mistakia May 31, 2021
b7ad2cc
docs: add TryNano under faucets section (#15)
OmarB97 May 31, 2021
5d5df81
docs: update privacy.md
mistakia Jun 1, 2021
49c1574
chore: add crontab sample file
mistakia Jun 2, 2021
56d534d
chore: reorg server configs
mistakia Jun 2, 2021
ed0bfa7
feat: fix energy usage stat bug
mistakia Jun 3, 2021
eb226c8
feat: user accounts
mistakia Jun 4, 2021
d2a4a53
feat: import telemetry
mistakia Jun 5, 2021
cd9de73
fix: handle promise rejections
mistakia Jun 5, 2021
73e80d4
feat: add rep uptime
mistakia Jun 5, 2021
53d3ebd
docs: updated misconceptions.md
mistakia Jun 7, 2021
ec5ca46
chore: lint
mistakia Jun 7, 2021
b9b8df0
feat: representatives api
mistakia Jun 8, 2021
58f8716
refactor: import rep meta
mistakia Jun 8, 2021
2ab867e
chore: update crontab
mistakia Jun 8, 2021
84f8a0c
docs update misconceptions
mistakia Jun 9, 2021
998ea27
docs: update investment-thesis.md (#16)
SenatusSPQR Jun 9, 2021
9afc5e4
feat: add representatives page
mistakia Jun 11, 2021
22726d8
feat: add version by weight
mistakia Jun 11, 2021
5df0999
feat: get network info
mistakia Jun 11, 2021
39b8d02
feat: add country by weight
mistakia Jun 11, 2021
e799598
feat: add stats menu
mistakia Jun 11, 2021
4ca3d99
feat: add tooltips to metric cards
mistakia Jun 11, 2021
89ac922
refactor: representatives table
mistakia Jun 11, 2021
f578e9d
fix: typo
mistakia Jun 11, 2021
c33ff80
feat: store telemetry data for all nodes
mistakia Jun 11, 2021
17926c9
feat: rollup uptime data into 2 hour intervals
mistakia Jun 11, 2021
4dc4cf8
fix: uptime rollup calculation
mistakia Jun 11, 2021
762d9d8
feat: show rep uptime
mistakia Jun 11, 2021
7bcfd52
fix: typo
mistakia Jun 12, 2021
9958c9f
feat: script to check for open rpc ports
mistakia Jun 12, 2021
d364ef6
feat: update representatives table
mistakia Jun 13, 2021
bea32d4
fixed typos (#19)
joewelow Jun 14, 2021
b81aa84
feat: add post tags api endpoint
mistakia Jun 15, 2021
dfb0eae
feat: add tags page
mistakia Jun 15, 2021
bdbb6d1
feat: build tags page
mistakia Jun 15, 2021
862c591
tags: update privacy
mistakia Jun 15, 2021
f36cbfa
feat: tags page add github authors
mistakia Jun 15, 2021
79fa6b6
docs: update misconceptions
mistakia Jun 15, 2021
6604fc1
feat: node healthcheck endpoint + rpc fallover
mistakia Jun 15, 2021
3dbb188
feat: store cemented and block count behind
mistakia Jun 15, 2021
ec90cf1
chore: update behind script
mistakia Jun 16, 2021
0c58c30
chore: remove x-grid
mistakia Jun 16, 2021
419fdbb
refactor: update block behind, remove cemented behind calc
mistakia Jun 16, 2021
5de74e3
refactor: representatives api endpoint
mistakia Jun 16, 2021
86e4b73
docs: update challenges
mistakia Jun 18, 2021
5470201
docs: update attack vectors
mistakia Jun 18, 2021
6941b9e
chore: grammer and spellcheck
mistakia Jun 19, 2021
05c3a3f
docs: update acquiring.md (#20)
dcoffm Jun 20, 2021
886e73e
chore: update site description & advantages doc (#21)
mistakia Jun 20, 2021
7fe80f1
feat: add count of reps to censor, total reps
mistakia Jun 21, 2021
bdf91db
chore: build
mistakia Jun 21, 2021
e9b23b6
Update acquiring.md (#39)
SenatusSPQR Jun 21, 2021
f6bb5bb
docs: update introduction page (#40)
mistakia Jun 22, 2021
569f6b2
feat: add script to get account meta
mistakia Jun 22, 2021
b47e6da
docs: update menu + update introduction
mistakia Jun 23, 2021
783938f
feat: add account meta to rep api
mistakia Jun 23, 2021
8edfc4d
feat: update rep weight to use account meta
mistakia Jun 23, 2021
72861d7
docs: update getting started devs
mistakia Jun 22, 2021
f912109
refactor: use markdown-it, add code-tabs, update dev getting started
mistakia Jun 25, 2021
665340f
docs: add choosing a rep page (#43)
mistakia Jun 25, 2021
12f1d50
docs: fix typo on introduction page (#44)
lennymlopes Jun 25, 2021
36dd7f7
docs: build
mistakia Jun 25, 2021
57545bb
docs: update introduction basics.md
mistakia Jun 25, 2021
dea2912
feat: add api endpoint for a representative
mistakia Jun 26, 2021
1dfb70f
feat: add rep page
mistakia Jun 26, 2021
34ab182
feat: add representatives block / confirmation scatter plots
mistakia Jun 27, 2021
ff83f34
fix: telemetry import ephemeral port bug
mistakia Jun 27, 2021
947b6c1
feat: filter representatives page
mistakia Jun 28, 2021
6c08277
feat: add weight column to representatives table + page width styling
mistakia Jun 28, 2021
51ad487
feat: save voting weight data
mistakia Jun 29, 2021
ac56a66
docs: update README
mistakia Jun 29, 2021
e57f0f9
docs: update README
mistakia Jun 29, 2021
5ef46f0
docs: update dev getting-started
mistakia Jun 29, 2021
a504d71
feat: add peer count & bandwdith limit to cluster charts
mistakia Jun 29, 2021
94079c5
feat: display unchecked count
mistakia Jun 29, 2021
2a7917a
feat: add protocol version
mistakia Jun 29, 2021
c0c5f37
feat: search reps and clear filter
mistakia Jun 29, 2021
b7b7bee
feat: add peers, blocks behind, confirmations behind charts for rep page
mistakia Jun 30, 2021
734e8f2
feat: click styling + fix ip filtering
mistakia Jun 30, 2021
58cd868
feat: add weight distribution by rep chart
mistakia Jun 30, 2021
db196ce
docs: update dev running-a-node
mistakia Jun 30, 2021
953752c
style: representatives search input
mistakia Jun 30, 2021
42ceb5f
style: typography / readability
mistakia Jun 30, 2021
dfefd56
feat: styling, update design.md, rep page navigation
mistakia Jun 30, 2021
16e36b5
chore: update rep meta importer
mistakia Jun 30, 2021
f4d4494
chore: update discord nt channel blacklist
mistakia Jun 30, 2021
f860a9a
style: update styling / mobile fixes
mistakia Jun 30, 2021
8b4e631
fix: exclude nanotrade from posts endpoints
mistakia Jun 30, 2021
e355c46
feat: add weight api endpoint
mistakia Jul 1, 2021
bc399a4
feat: use max of online or trending voting weight
mistakia Jul 1, 2021
8cbfec7
style: reps page
mistakia Jul 1, 2021
9bea651
fix typo in choosing-a-representative.md (#45)
keerifox Jul 1, 2021
675ad59
feat: reps page quorum weight charts
mistakia Jul 1, 2021
fd8642e
feat: format reps quorum weight chart tooltips
mistakia Jul 1, 2021
b6fcb13
fix: quorum weight action listener
mistakia Jul 1, 2021
a01ae57
refactor: rep page quorum history charts + table, sections styling
mistakia Jul 2, 2021
68fdd33
docs: update storing/setup.md, investment-thesis.md, misconceptions.m…
mistakia Jul 2, 2021
75208e1
refactor: update reps table ordering and styling
mistakia Jul 2, 2021
ed82962
fix: typo protocol-reference.md
mistakia Jul 2, 2021
ca43c09
fix: missing prop validation uptime component
mistakia Jul 2, 2021
ee41ce2
docs: update design reference table
mistakia Jul 2, 2021
caae23d
refactor: rep -> account page + fix rep endpoint when missing rep
mistakia Jul 2, 2021
83b08ef
refactor: use median value for online stake
mistakia Jul 2, 2021
7dfd36d
feat: use svg for uptime display
mistakia Jul 2, 2021
70dfddf
docs: update dev getting-started.md
mistakia Jul 2, 2021
dcce853
feat: account page styling
mistakia Jul 3, 2021
1ae0339
refactor: remove rep endpoint, use account endpoint
mistakia Jul 3, 2021
52dc35e
fix: doc page prevent reflow on load
mistakia Jul 3, 2021
93f6687
fix: 404 page not found bug on account pages
mistakia Jul 3, 2021
9afdcf6
style: reps & rep page
mistakia Jul 3, 2021
f20cd92
refactor: use dayjs instead of moment
mistakia Jul 4, 2021
a0cbb1c
chore: script rollup daily uptime
mistakia Jul 4, 2021
b4391e3
fix: rollup-uptime script
mistakia Jul 4, 2021
74ff839
feat: calculate uptime script
mistakia Jul 4, 2021
a73cd62
feat: link to rep page
mistakia Jul 4, 2021
76dc576
style: rep page warning color & fix mobile overflow
mistakia Jul 4, 2021
8c209bb
fix: uptime percentage typo
mistakia Jul 4, 2021
c0e56a5
debug: injected style ordering
mistakia Jul 4, 2021
ea693cc
docs: update advantages
mistakia Jul 5, 2021
b09f24e
docs: update quorum / design basics.md
mistakia Jul 5, 2021
9a997c1
feat: add last_online, last_offline to reps endpoint
mistakia Jul 6, 2021
80fb924
refactor: small cleanups
mistakia Jul 6, 2021
3d0fff4
feat: offline reps table
mistakia Jul 6, 2021
457894b
feat: script to get rep info for accounts
mistakia Jul 7, 2021
89103b5
fix: accounts rep import script
mistakia Jul 7, 2021
4a1dfe1
chore: update schema
mistakia Jul 7, 2021
5fe134c
feat: add endpoint to get account delegators
mistakia Jul 7, 2021
e7d54d3
feat: add top delegators table to rep page
mistakia Jul 7, 2021
dc685f4
fix: rep page location change load bug
mistakia Jul 7, 2021
10ce49e
fix: account api endpoint data type mismatch
mistakia Jul 7, 2021
4979dbf
refactor: update delegators endpoints, exclude unused fields
mistakia Jul 7, 2021
5dacdfb
fix: parsing telemetry timestamp into unix
mistakia Jul 7, 2021
d7ebccb
fix: parsing telemetry timestamp into unix
mistakia Jul 8, 2021
0ef6f47
feat: add nanodb status api endpoint
mistakia Jul 8, 2021
43db74e
feat: wildcard redirect nanodb requests
mistakia Jul 8, 2021
f6e0cc0
feat: add ledger stats page
mistakia Jul 11, 2021
416a660
feat: add rep alerts section to home
mistakia Jul 12, 2021
8b73b42
style: homepage
mistakia Jul 12, 2021
72833c0
style: home page
mistakia Jul 12, 2021
bcbac5e
chore: update schema
mistakia Jul 13, 2021
1cab624
refactor: parallelize reps endpoint query
mistakia Jul 13, 2021
5d840e6
refactor: reps endpoint cache ttl
mistakia Jul 13, 2021
7663330
fix: yaxis label cutoff on mobile + tooltip styling
mistakia Jul 13, 2021
eedcc75
feat: tooltips for rep issue chips
mistakia Jul 13, 2021
e87725d
refactor: prioritize offline over behind (rep alerts) + cleanup netwo…
mistakia Jul 13, 2021
9d5584d
refactor: rep last online styling
mistakia Jul 13, 2021
cef026b
feat: add low uptime to rep alerts
mistakia Jul 13, 2021
3f1d613
feat: ledger chart addresses show reused
mistakia Jul 13, 2021
bccb648
feat: accounts block summary endpoint
mistakia Jul 14, 2021
7f57ac9
feat: add account blocks summary and open endpoints
mistakia Jul 14, 2021
eb3c467
feat: add account_info fields to account endpoint
mistakia Jul 14, 2021
1ce6ce9
feat: add account meta component
mistakia Jul 15, 2021
7fc72ea
fix: get non-rep account alias
mistakia Jul 15, 2021
0bb0676
fix: account meta balance format
mistakia Jul 15, 2021
8a0c649
style: account page
mistakia Jul 15, 2021
02da36f
fix: github events overflow styling
mistakia Jul 16, 2021
ff52c87
fix: account meta height default value
mistakia Jul 17, 2021
610db1b
feat: handle unopened accounts
mistakia Jul 17, 2021
071b232
feat: perpetually cache representatives endpoint
mistakia Jul 18, 2021
07ef23d
fix: typo
mistakia Jul 18, 2021
4e78376
docs update introduction - focus on nano + more concise
mistakia Jul 18, 2021
f45e86d
docs: update acquiring.md facuets
mistakia Jul 18, 2021
48b0e76
fix: exclude WatchEvent from github events
mistakia Jul 18, 2021
cb2401a
fix: typo
mistakia Jul 18, 2021
3a10f73
fix: typo
mistakia Jul 18, 2021
9412861
feat: import nanotipbot addresses
mistakia Jul 18, 2021
db9770c
feat: import graham tipbot addresses
mistakia Jul 18, 2021
9322357
feat: get blocks summary
mistakia Jul 19, 2021
8e17192
feat: collapse rep delegators table
mistakia Jul 19, 2021
5ee19e4
style: account page loading, collapse delegators
mistakia Jul 19, 2021
77620d8
feat: add y-axis labels for rep charts
mistakia Jul 19, 2021
42358b0
style: account page rep charts menu
mistakia Jul 19, 2021
a4abd75
feat: add account blocks summary tables
mistakia Jul 19, 2021
336ec07
style: home page
mistakia Jul 19, 2021
9badc62
fix: home styling
mistakia Jul 19, 2021
2f19474
fix: github shorten branch name
mistakia Jul 19, 2021
7caedc6
style: github loading
mistakia Jul 20, 2021
c851e24
style: home page
mistakia Jul 20, 2021
02970ca
style: rep alerts
mistakia Jul 20, 2021
ed202f2
style: rep alerts
mistakia Jul 21, 2021
f0d42a5
fix: typo
mistakia Jul 21, 2021
5017e24
docs: update why-it-matters.md
mistakia Jul 21, 2021
cfb875c
fix: rep censor, stall, confirm calculations
mistakia Jul 21, 2021
53817cb
style: github and dev events
mistakia Jul 21, 2021
ee111e4
style: rep alert
mistakia Jul 21, 2021
b2026a2
docs: update investment-thesis.md & basics.md
mistakia Jul 22, 2021
ddb347d
style: account page
mistakia Jul 23, 2021
c49fcdf
feat: add block page
mistakia Jul 23, 2021
85b430a
style: drawer menu
mistakia Jul 22, 2021
57aaf12
fix: fractional nano values
mistakia Jul 24, 2021
892b18d
docs: update protocol-reference.md
mistakia May 28, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
10 changes: 9 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
module.exports = {
parser: 'babel-eslint',
ignorePatterns: ['build/*'],
env: {
browser: true,
Expand All @@ -19,10 +20,17 @@ module.exports = {
},
plugins: ['react'],
rules: {
'generator-star-spacing': [
'error',
{
before: false,
after: true
}
],
'space-before-function-paren': [
'error',
{
anonymous: 'never',
anonymous: 'always',
named: 'never',
asyncArrow: 'always'
}
Expand Down
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,8 @@ yarn-error.log

# App specific
#
build/
build/favicon.ico
!build/*.html
!build/sitemap.xml
!build/**/*.html
config.js
127 changes: 127 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
Nano.Community aims to be a community run project and is grateful to all that step up to contribute. You don't need permission to work on anything, but it's always best to let others know what you're planning to do. You can do this by:

- Commenting on an [issue or PR in GitHub](https://github.com/mistakia/nano-community/issues)
- Messaging on the [Nano Discord server](https://chat.nano.org/) (dm: trashman#2397)
- Starting a [discussion](https://github.com/mistakia/nano-community/discussions)

Before contributing, make sure you're familiar with <a href="https://guides.github.com/introduction/flow/index.html" tagret="_blank">GitHub Flow</a>.

### Contributing content

All you need is a GitHub account to contribute. Every page is a MarkDown file, which is an <a href="https://guides.github.com/features/mastering-markdown/" target="_blank">easy to learn syntax</a>.

#### Submitting Edits

- Use the "edit page" button on the site to navigate to the document on the github repository
- Make sure to sign in or create a GitHub account
- Once logged in, start editing by clicking the "edit file" icon in the top right
- Make changes, then click "propose changes". On the next page click "Create Pull Request" to submit.

#### Responding to Change Requests

Occasionally, changes will be requested for proposed changes. Navigate to your pull request to respond with any questions or comments. To make changes, navigate to the branch you used on your fork, make changes and commit them. The pull request will then be automatically updated with those changes.

#### Rules

1. [Write simply](http://www.paulgraham.com/simply.html)
1. Keep content for users concise, while detailed for developers
1. When possible, direct users to existing content on the [official Nano documentation](https://docs.nano.org/)
1. Use an impartial tone and neutral point of view. Content should be as objective as possible.
1. Pull requests are preferred to issues, especially for small changes such as typos.
1. Issues should be used for reporting bugs, typos, or other specific content
1. Discussions should be used for generic or broad-based changes or missing content (i.e. suggesting a faq, or content section)
1. Smaller pull requests are preferred over a single large one.
1. Limit mentioning or using content that changes over time, to prevent content from going stale and needing updates

### Contributing code

JavaScript & markdown are used to make the project as accessible as possible.

```
|-- api node.js api server for posts, network stats
|-- build static html react entry points generated by react-snap
|-- db schema for mysql
|-- docs wiki & knowledge hub
|-- scripts data aggregation or processing
|-- server server configs
|-- src single page react app (deployed to IPFS)
`-- tags docs for each topic (content category)
```

#### Set up your local environment

1. Install [Node.js](https://nodejs.org/) and [Yarn](https://yarnpkg.com/)

2. Clone your fork

```
git clone git@github.com:[your_github_handle]/nano-community.git && cd nano-community
```

3. Add upstream remote

```
git remote add upstream https://github.com/mistakia/nano-community.git
```

To sync your fork with the latest changes

```
git checkout main
git fetch upstream
git merge upstream/main
```

4. Install dependencies

```
yarn install
```

#### Start contributing

1. Create a new branch for your changes

```
git checkout -b new_feature_name
```

2. Start developing

```
yarn dev
```

3. Before committing your changes, make sure to run prettier, lint, and build.

```
yarn prettier
yarn lint
yarn build
```

## Developer's Certificate of Origin 1.1

By making a contribution to this project, I certify that:

(a) The contribution was created in whole or in part by me and I
have the right to submit it under the open source license
indicated in the file; or

(b) The contribution is based upon previous work that, to the best
of my knowledge, is covered under an appropriate open source
license and I have the right under that license to submit that
work with modifications, whether created in whole or in part
by me, under the same open source license (unless I am
permitted to submit under a different license), as indicated
in the file; or

(c) The contribution was provided directly to me by some other
person who certified (a), (b) or (c) and I have not modified
it.

(d) I understand and agree that this project and the contribution
are public and that a record of the contribution (including all
personal information I submit with it, including my sign-off) is
maintained indefinitely and may be redistributed consistent with
this project or the open source license(s) involved.
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2021 nano.community contributors

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
52 changes: 18 additions & 34 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,49 +1,33 @@
# Nano Wiki
# Nano.Community

## Vision / Purpose
[Nano.Community](https://nano.community/) is a community run project thats improved over time through contributions from community members. If you're interested in helping improve [nano.community](https://nano.community/), start by reading the [contribution guidelines](https://github.com/mistakia/nano-community/blob/main/CONTRIBUTING.md).

Nano Wiki aims to be the a portal to Nano's growing community, maintaining docs, guides, and conventions to improve community communication & onboarding.
## Design

**Primary Goals**
### Markdown Documents

- Help new members discover and understand existing ideas, discussions in an easily consumable manner
- Help existing members point new members to old ideas, discussions, conclusions, etc
- Help new member onboarding, especially for code contributions from developers
A set of community maintained markdown documents

**Secondary Goals**
- landing pages
- guides
- onboarding
- documentation
- support

- Serve as a chronicle of events, discussions, comments, ideas, etc. Documentating Nano culture & history
- Keep the community at large informed — serve as a centralized place to easily and quickly track an open and distributed project
- Measure community support for or against ideas by nano account based voting
### Nano Based Accounts & Voting

**Principles**
Accounts are a generated key-pair where the public key is signed by the private key pertaining to a nano account. This will allow associating a user's actions and content to an account (representative) on the nano network. The signing process will take place within a wallet (or on the commandline) and will not increase the risk/attack surface for a nano private key. This feature can be used to automate moderation of contributions as well as measuring support for or against certain content (proposals, ideas, comments, etc).

- Open
- Distributed — operate indefinetly without reliance on centralized elements (servers, people, etc)
### Content Aggregation

**Project Components**
Automatic content aggregation and indexing

- Markdown Wiki Documents
- Onboarding / Contribution Guides
- Community Conventions
- Nano Improvement Proposals (i.e. RFC)
- Nano Based Accounts & Voting
- Content Aggregator / Crawler (automatic content importing and chronicling)

## Contribution Guides

- Nano Docs
- Nano Code
- Nano Wiki

## Community Conventions

- Reddit
- Reddit Subreddit
- Reddit User
- Forum
- Discord
- Github

## Templates
### Content Categorization

- Wiki Document
- Forum Post
Content can be tagged to a topic to allow for members to easily explore past discussions around a certain topic. Each topic will have a neutral, concise, and high-level summary with links to notable comments. Topics exist to easily point new members to past conversations as new members will naturally think of things already discussed by past members.
4 changes: 4 additions & 0 deletions api/cache.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
const NodeCache = require('node-cache')
const cache = new NodeCache({ stdTTL: 600, checkperiod: 120 })

module.exports = cache
52 changes: 52 additions & 0 deletions api/cron.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
const cron = require('node-cron')

const db = require('../db')

const updateSources = async () => {
const sources = await db('sources')
const sids = sources.map((s) => s.id)
for (const sid of sids) {
await updateSourceScore(sid)
}
}

const updateSourceScore = async (sid) => {
const query = db('posts')
query.select(db.raw('avg(score) as score_avg'))
query.where('sid', sid)
query.where('score', '>', 1.0)
query.whereRaw('created_at >= (UNIX_TIMESTAMP() - (86400 * 14))')
const result = await query
// eslint-disable-next-line camelcase
const { score_avg } = result[0]
// eslint-disable-next-line camelcase
if (score_avg) {
await db('sources').update({ score_avg }).where('id', sid)
}
}

cron.schedule('*/15 * * * *', async () => {
if (process.env.NODE_ENV !== 'production') {
return
}

try {
await updateSources()
} catch (err) {
console.log(err)
}
})

if (!module.parent) {
const init = async () => {
await updateSources()
process.exit()
}

try {
init()
} catch (err) {
console.log(err)
process.exit()
}
}
3 changes: 3 additions & 0 deletions api/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// eslint-disable-next-line
require = require('esm')(module /*, options*/)
module.exports = require('./server.js')
52 changes: 52 additions & 0 deletions api/routes/accounts/blocks.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
const express = require('express')

const { request } = require('../../../common')
const { nanodbAPI } = require('../../../config')

const router = express.Router({ mergeParams: true })

router.get('/:type/summary', async (req, res) => {
const { logger, db } = req.app.locals
try {
const { address, type } = req.params

if (!address) {
return res.status(401).send({ error: 'missing address' })
}

const re = /^(nano|xrb)_[13]{1}[13456789abcdefghijkmnopqrstuwxyz]{59}$/gi
if (!re.test(address)) {
return res.status(401).send({ error: 'invalid address' })
}

if (!type) {
return res.status(401).send({ error: 'missing type' })
}

const types = ['send', 'receive', 'change']
if (!types.includes(type)) {
return res.status(401).send({ error: 'invalid type' })
}

const limit = Math.min(parseInt(req.query.limit || 100, 0), 100)
const offset = parseInt(req.query.offset, 0) || 0

const url = `${nanodbAPI}/accounts/${address}/blocks/${type}/summary?limit=${limit}&offset=${offset}`
const data = await request({ url })
const addresses = data.map((d) => d.destination_account)
const rows = await db('accounts')
.select('account', 'alias')
.whereIn('account', addresses)

for (let i = 0; i < data.length; i++) {
const item = rows.find((r) => r.account === data[i].destination_account)
data[i].destination_alias = item ? item.alias : null
}
res.status(200).send(data)
} catch (error) {
logger(error)
res.status(500).send({ error: error.toString() })
}
})

module.exports = router