├── .gitignore
├── LICENSE
├── README.md
├── docs
├── en
│ ├── faq.md
│ ├── help_zeronet
│ │ ├── coding_conventions.md
│ │ ├── contributing.md
│ │ ├── donate.md
│ │ └── network_protocol.md
│ ├── index.md
│ ├── site_development
│ │ ├── cert_authority.md
│ │ ├── content_json.md
│ │ ├── dbschema_json.md
│ │ ├── getting_started.md
│ │ └── zeroframe_api_reference.md
│ ├── translation.md
│ └── using_zeronet
│ │ ├── create_new_site.md
│ │ ├── installing.md
│ │ └── sample_sites.md
├── fr
│ ├── faq.md
│ ├── help_zeronet
│ │ ├── coding_conventions.md
│ │ ├── contributing.md
│ │ ├── donate.md
│ │ └── network_protocol.md
│ ├── index.md
│ ├── site_development
│ │ ├── cert_authority.md
│ │ ├── content_json.md
│ │ ├── dbschema_json.md
│ │ ├── getting_started.md
│ │ └── zeroframe_api_reference.md
│ ├── translation.md
│ └── using_zeronet
│ │ ├── create_new_site.md
│ │ ├── installing.md
│ │ └── sample_sites.md
├── it
│ ├── faq.md
│ ├── help_zeronet
│ │ ├── coding_conventions.md
│ │ ├── contributing.md
│ │ ├── donate.md
│ │ └── network_protocol.md
│ ├── index.md
│ ├── site_development
│ │ ├── cert_authority.md
│ │ ├── content_json.md
│ │ ├── dbschema_json.md
│ │ ├── getting_started.md
│ │ └── zeroframe_api_reference.md
│ ├── translation.md
│ └── using_zeronet
│ │ ├── create_new_site.md
│ │ ├── installing.md
│ │ └── sample_sites.md
├── resources
│ ├── ZeroFrame.js
│ ├── bitcoinbar
│ │ ├── bitcoinbar.css
│ │ └── bitcoinbar.js
│ ├── docs.css
│ ├── docs.js
│ ├── fonts
│ │ ├── roboto-mono-v5-latin-ext_latin-regular.woff
│ │ ├── roboto-mono-v5-latin-ext_latin-regular.woff2
│ │ ├── roboto-v18-latin-ext_latin-300.woff
│ │ ├── roboto-v18-latin-ext_latin-300.woff2
│ │ ├── roboto-v18-latin-ext_latin-700.woff
│ │ ├── roboto-v18-latin-ext_latin-700.woff2
│ │ ├── roboto-v18-latin-ext_latin-italic.woff
│ │ ├── roboto-v18-latin-ext_latin-italic.woff2
│ │ ├── roboto-v18-latin-ext_latin-regular.woff
│ │ └── roboto-v18-latin-ext_latin-regular.woff2
│ ├── img
│ │ ├── domain.png
│ │ ├── reactiongifs.jpg
│ │ ├── zeroblog.png
│ │ ├── zeroboard.png
│ │ ├── zerochat.png
│ │ ├── zerohello-old.png
│ │ ├── zerohello.png
│ │ ├── zeromail.png
│ │ ├── zerome.png
│ │ ├── zerotalk-old.png
│ │ └── zerotalk.png
│ ├── javascripts
│ │ └── menu.js
│ ├── jquery.min.js
│ ├── logo
│ │ ├── favicon.ico
│ │ └── zeronet_logo.svg
│ ├── partials
│ │ └── header.html
│ └── stylesheets
│ │ └── menu.css
└── zh
│ ├── faq.md
│ ├── help_zeronet
│ ├── coding_conventions.md
│ ├── contributing.md
│ ├── donate.md
│ └── network_protocol.md
│ ├── index.md
│ ├── site_development
│ ├── cert_authority.md
│ ├── content_json.md
│ ├── dbschema_json.md
│ ├── getting_started.md
│ └── zeroframe_api_reference.md
│ ├── translation.md
│ └── using_zeronet
│ ├── create_new_site.md
│ ├── installing.md
│ └── sample_sites.md
├── example
└── ZeroFrame
│ ├── content.json
│ ├── data
│ └── messages.json
│ ├── dbschema.json
│ ├── index.html
│ └── js
│ ├── MySite.coffee
│ ├── all.js
│ └── lib
│ └── ZeroFrame.coffee
├── mkdocs-fr.yml
├── mkdocs-it.yml
├── mkdocs-readthedocs.yml
├── mkdocs-zh.yml
├── mkdocs.yml
├── readthedocs.yml
├── requirements.txt
├── start.py
└── start.sh
/.gitignore:
--------------------------------------------------------------------------------
1 | # Byte-compiled / optimized / DLL files
2 | __pycache__/
3 | *.py[cod]
4 |
5 | # Unit test / coverage reports
6 | htmlcov/
7 | .tox/
8 | .coverage
9 | .cache
10 | nosetests.xml
11 | coverage.xml
12 |
13 | # Translations
14 | *.mo
15 | *.pot
16 |
17 | # Django stuff:
18 | *.log
19 |
20 | # Sphinx documentation
21 | docs/_build/
22 |
23 | # Hidden files
24 | .*
25 |
26 | # Built site
27 | site/
28 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | Available at
2 | https://zeronet.io/docs
3 |
4 | ## Building
5 |
6 | First install the following from pip:
7 |
8 | * mkdocs
9 | * mkdocs-material
10 | * pymdown-extensions
11 |
12 | Then simply run `mkdocs serve` to host a local version of the docs, or `mkdocs
13 | build` to output a static version.
14 |
15 | ## French doc
16 |
17 | Serve:
18 |
19 | `mkdocs serve -f mkdocs-fr.yml`
20 |
21 | Build:
22 | `mkdocs build -f mkdocs-fr.yml -d site-fr`
23 |
24 | ## Create a new translation
25 |
26 | You will need to duplicate the `mkdocs.yml` file and rename it to add the language code according to ISO 639-1 (https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) it is used for.
27 | Example : `mkdocs-fr.yml`
28 |
29 | Modify the default lang for lunr search :
30 | ```
31 | plugins:
32 | - search:
33 | lang: ['fr']
34 | ```
35 |
36 | Modify the language theme to fit the one you translate it for.
37 | Example :
38 | ```
39 | theme:
40 | language: 'de'
41 | ```
42 |
43 | Translate the nav is willing language.
44 |
45 | Now in `docs` duplicate the folder `en/` and rename it with appropriate language code.
46 | Example : `fr/`
47 |
48 | Now you can translate the documentation. Thank you.
49 |
50 | ## Generate all the doc files
51 |
52 | ```
53 | mkdocs build -f mkdocs.yml & mkdocs build -f mkdocs-fr.yml
54 | ```
55 |
--------------------------------------------------------------------------------
/docs/en/help_zeronet/coding_conventions.md:
--------------------------------------------------------------------------------
1 | # Coding standards if you want to collaborate to ZeroNet
2 | - Follow [PEP8](https://www.python.org/dev/peps/pep-0008/)
3 | - Simple is better than complex
4 | - Premature optimization is the root of all evil
5 |
6 | ### Naming
7 | - ClassNames: Capitalized, CamelCased
8 | - functionNames: starts with lowercase, camelCased
9 | - variable_names: lowercased, under_scored
10 |
11 | ### Variables
12 | - file_path: File path realtive to working dir (data/17ib6teRqdVgjB698T4cD1zDXKgPqpkrMg/css/all.css)
13 | - inner_path: File relative to site dir (css/all.css)
14 | - file_name: all.css
15 | - file: Python file object
16 | - privatekey: Private key for the site (without _)
17 |
18 | ### Source files directories and naming
19 | - One class per file is preferred
20 | - Source file name and directory comes from ClassName: WorkerManager class = Worker/WorkerManager.py
21 |
--------------------------------------------------------------------------------
/docs/en/help_zeronet/contributing.md:
--------------------------------------------------------------------------------
1 | # Contributing to ZeroNet
2 |
3 | Thank you for using ZeroNet. ZeroNet is a collaborative effort of 67+ decentralization enthusiasts just like you. We appreciate all users that catch bugs, improve documentation and have good ideas of designing new protocols. Here are a few guidelines we ask you to follow to get started with making your contribution.
4 |
5 | ### You don’t have to contribute source code
6 |
7 | In fact, a majority of contributors do not submit source code. Even if you like to write programs, other types of contribution are also welcomed.
8 |
9 | ### Do you like to write?
10 |
11 | - Write about ZeroNet.
12 | - Write tutorials to help people set things up.
13 | - Help translate ZeroNet.
14 | - Improve this documentation. This documentation is a written by many community members all over the world.
15 |
16 | ### Do you like helping people?
17 |
18 | - Subscribe to our [issue tracker on GitHub](https://github.com/HelloZeroNet/ZeroNet/issues) and help people solve problems.
19 | - Join us on [Gitter](https://gitter.im/HelloZeroNet/ZeroNet) and IRC channel [#zeronet @ freenode](https://kiwiirc.com/client/irc.freenode.net/zeronet) and help answer questions.
20 | - Set up a seed box and help make the network faster.
21 |
22 | ### Do you like to make websites?
23 |
24 | - Create new ZeroNet sites. Go ahead and make your own blog on ZeroNet. [It is easy and costs little.](../using_zeronet/create_new_site.md)
25 | - “Content is king!” as NoFish puts. The network is worth nothing without content, so we need You to make it succeed.
26 |
27 | ### Do you like to do research?
28 |
29 | - Help us investigate our [hard issues](https://github.com/HelloZeroNet/ZeroNet/labels/help%20wanted).
30 | - Join our discussion of designing new features and protocols, such as [I2P support](https://github.com/HelloZeroNet/ZeroNet/issues/45) and [DHT support](https://github.com/HelloZeroNet/ZeroNet/issues/57).
31 | - Do you own a [Raspberry Pi](https://github.com/HelloZeroNet/ZeroNet#linux-terminal), a [C.H.I.P.](http://127.0.0.1:43110/Blog.ZeroNetwork.bit/?Post:94:Running+ZeroNet+on+a+$9%C2%A0computer) or an [open router](https://github.com/HelloZeroNet/ZeroNet/issues/783)? Try running ZeroNet on it and tell us how well ZeroNet works on your device.
32 |
33 | ### Do you like to write code?
34 |
35 | - If you know Python, you can pick a task from our [issue tracker on GitHub](https://github.com/HelloZeroNet/ZeroNet/issues).
36 | - You are also welcomed develop your own ideas. Before you start, please [open a new discussion](https://github.com/HelloZeroNet/ZeroNet/issues/new) to let the community know, so you can make sure we can share our ideas to make the best out of it.
37 | - Keep your coding style consistent. We ask you to follow our coding convention below.
38 |
39 | ### Do you like to offer financial support?
40 |
41 | - You can [donate bitcoins](donate.md) to support ZeroNet.
42 |
43 |
44 | ## Coding convention
45 |
46 | - Follow [PEP8](https://www.python.org/dev/peps/pep-0008/)
47 | - Simple is better than complex
48 | - Premature optimization is the root of all evil
49 |
50 | ### Naming
51 | - ClassNames: Capitalized, CamelCased
52 | - functionNames: starts with lowercase, camelCased
53 | - variable_names: lowercased, under_scored
54 |
55 | ### Variables
56 | - file_path: File path relative to working dir (data/17ib6teRqdVgjB698T4cD1zDXKgPqpkrMg/css/all.css)
57 | - inner_path: File relative to site dir (css/all.css)
58 | - file_name: all.css
59 | - file: Python file object
60 | - privatekey: Private key for the site (without `_`)
61 |
62 | ### Source files directories and naming
63 | - One class per file is preferred
64 | - Source file name and directory comes from ClassName: WorkerManager class = Worker/WorkerManager.py
65 |
--------------------------------------------------------------------------------
/docs/en/help_zeronet/donate.md:
--------------------------------------------------------------------------------
1 | # Help to keep ZeroNet development alive
2 |
3 | - Bitcoin: [1QDhxQ6PraUZa21ET5fYUCPgdrwBomnFgX](bitcoin:1QDhxQ6PraUZa21ET5fYUCPgdrwBomnFgX?Label=ZeroNet+donation)
4 | - PayPal: [https://www.paypal.me/zeronet/0usd](https://www.paypal.me/zeronet/0usd)
5 |
6 | Thanks!
7 |
--------------------------------------------------------------------------------
/docs/en/index.md:
--------------------------------------------------------------------------------
1 | ## What is ZeroNet?
2 |
3 | ZeroNet uses Bitcoin cryptography and BitTorrent technology to build a **decentralized censorship-resistant network**.
4 |
5 | Users can publish static or dynamic websites to ZeroNet and visitors can choose to also serve the site themselves. Websites will remain online as long as one peer is still online.
6 |
7 | When a site is updated by its owner, all nodes serving that site (previous visitors) will receive only the incremental updates made to the site content.
8 |
9 | ZeroNet comes with a built-in SQL database. This makes content-heavy site development easy. The DB is then synced to hosting nodes via incremental updates.
10 |
11 |
12 | ## Why?
13 |
14 | * We believe in open, free, and uncensored communication.
15 | * No censorship: After something is published there is no way to remove it.
16 | * No single point of failure: Content remains online even if only one peer is serving it.
17 | * Impossible to shut down: It's nowhere because it's everywhere. Content is served by any user who wishes to.
18 | * Fast: ZeroNet uses BitTorrent technology to deliver content faster than centralised servers.
19 | * Works offline: You can access the site even if your internet is unavailable.
20 | * Secure: Content ownership is secured using the same cryptography that secures your Bitcoin wallet.
21 |
22 | [comment]: <> (I'm unsure about the following bit. Thoughts?)
23 | [comment]: <> (# What problem is ZeroNet solving?)
24 |
25 | [comment]: <> (When Tim Berners-Lee created the internet, he meant for it to be free. Not surveilled nor censored. And [he is still fighting for that](http://edition.cnn.com/2014/03/12/tech/web/tim-berners-lee-web-freedom/).)
26 |
27 | [comment]: <> (The internet is centralized mainly in two places: Content and Domain Names (URLs) are hosted and controlled by central servers. If you control the central servers (and if you are powerful enough you do) you control the network.)
28 |
29 | [comment]: <> (**Decentralized content storage**)
30 |
31 | [comment]: <> (ZeroNet tackles the content storage problem by giving everyone the ability to store content. Site visitors can choose to store a website on their computers, and when they do this they also help to serve the site to other users. The site is online even if only one user is hosting it.)
32 |
33 | [comment]: <> (**Shared DNS cache**)
34 |
35 | [comment]: <> (Site addresses on ZeroNet are cached by all network members. When you type a ZeroNet site URL on your browser this will query other peers connected to you about the site. If one of these peers happen to have the site they will send it to you, if not, they will forward your query along.)
36 |
37 | [comment]: <> (This architecture means that when a site URL is created, as long as one peer is serving it, there is no way to take the URL down.)
38 |
39 |
40 | ## Features
41 | * Easy, zero configuration setup.
42 | * Password-less [BIP32](https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki)
43 | based authorization: Your account is protected by the same cryptography as your Bitcoin wallet.
44 | * Sites updated in real-time, no refreshing needed.
45 | * Namecoin .bit domains support.
46 | * SQL Database support: Allows for easier site development and faster page load times.
47 | * Anonymity: Full Tor network support with .onion hidden services instead of ipv4 addresses.
48 | * TLS encrypted connections.
49 | * Automatic, uPnP port opening.
50 | * Plugin for multiuser (openproxy) support.
51 | * Works with any browser/OS.
52 |
53 |
54 | ## How does it work?
55 |
56 | * After you install and run ZeroNet, you open a site by visiting:
57 | `http://127.0.0.1:43110/{zeronet_site_address}`
58 | (e.g. `http://127.0.0.1:43110/1HeLLo4uzjaLetFx6NH3PMwFP3qbRbTf3D`).
59 | * ZeroNet will then use the BitTorrent network to find peers that are seeding the site and will download the site content (HTML, CSS, JS...) from these peers.
60 | * Each site visited is then served by your client. Sites can be removed or blacklisted if necessary.
61 | * Every site contains a list of all of its files, each entry containing a SHA512 hash and a signature generated using the site owner's private key.
62 | * If the site owner modifies the site, then he/she signs a new list and publishes it to the peers.
63 | After the peers have verified the files list integrity (using the
64 | signature), they download the modified files and publish the new content to
65 | other peers.
66 |
67 | ##### [Slideshow about ZeroNet cryptography, content updates, multi-user sites »](https://docs.google.com/presentation/d/1_2qK1IuOKJ51pgBvllZ9Yu7Au2l551t3XBgyTSvilew/pub?start=false&loop=false&delayms=3000)
68 |
69 |
70 | ## Screenshots
71 |
72 | 
73 |
74 | 
75 |
76 | ##### [More screenshots »](using_zeronet/sample_sites/)
77 |
78 | ## Current limitations
79 |
80 | * No torrent-like, file splitting for big file support (BigFile plugin enables this)
81 | * File transactions are not compressed or encrypted yet (TLS encryption added)
82 | * No private sites
83 |
84 | ## Help to keep this project alive
85 |
86 | Bitcoin: 1QDhxQ6PraUZa21ET5fYUCPgdrwBomnFgX
87 |
88 | [Full donation page](help_zeronet/donate/)
89 |
90 | ### Thank you!
91 |
92 | * More info, help, changelog, zeronet sites: [http://www.reddit.com/r/zeronet/](http://www.reddit.com/r/zeronet/)
93 | * Come, chat with us: [#zeronet @ FreeNode](https://kiwiirc.com/client/irc.freenode.net/zeronet) or on [gitter](https://gitter.im/HelloZeroNet/ZeroNet)
94 |
--------------------------------------------------------------------------------
/docs/en/site_development/cert_authority.md:
--------------------------------------------------------------------------------
1 | # Certificate Authority
2 |
3 | An account without password? A certificate for me? You realize the ID system of ZeroNet does not conform to convention. In this section, you are going to learn about how user certificate and certificate authority work in ZeroNet.
4 |
5 | ## What does a certificate authority do?
6 |
7 | In ZeroNet, everything is signed by Bitcoin signing keys. A certificate provides a unique and memorizable name for a Bitcoin address. A certificate authority (or an ID provider) is responsible for proving the relationship between a unique friendly name and a Bitcoin address.
8 |
9 | ## Certificate format
10 |
11 | ### Body
12 |
13 | The body of a certificate contains a Bitcoin address, a portal type, and a memorizable user name.
14 |
15 | ```
16 | [BitcoinAddress]#[PortalType]/[UserName]
17 | ```
18 |
19 | **Example:**
20 |
21 | ```
22 | 1H28iygiKXe3GUMcD77HiifVqtf3858Aft#web/hellozeronet
23 | ```
24 |
25 | - Bitcoin address: `1H28iygiKXe3GUMcD77HiifVqtf3858Aft`
26 | - Portal type: `web`
27 | - User name: `hellozeronet`
28 |
29 | **General rules:**
30 |
31 | The Bitcoin address, the portal type and the user name **must not** contain the character `#`, `@` or `/`
32 |
33 | Only 0-9 and a-z are allowed in a user name. All English letters in a user name **must** be in lower case. Characters not in the allowed set **must not** be used as parts of a user name. A user name **should not** be too long. A user name **should** be legible and **should not** interfere with user interface rendering.
34 |
35 | A user name **must** be unique in the pool of all registered user names.
36 |
37 | ### Signature
38 |
39 | A certificate signing algorithm loads a secret signing key and generates a deterministic Bitcoin signature for the body.
40 |
41 | **From the source code:**
42 |
43 | ```python
44 | sign = os.popen("python zeronet.py --debug cryptSign %s#bitmsg/%s %s 2>&1" % (auth_address, user_name, config.site_privatekey)).readlines()[-1].strip()
45 | ```
46 |
47 | ### Certificate
48 |
49 | By looking at the source code of ZeroID, we know how a certificate is stored in its public database.
50 |
51 | ```python
52 | data["users"][user_name] = "bitmsg,%s,%s" % (auth_address, sign)
53 | ```
54 |
55 | **Example:**
56 |
57 | ```
58 | "hellozeronet": "web,1H28iygiKXe3GUMcD77HiifVqtf3858Aft,HA2A+iKekECD3hasrsN8IrR86BnXQ63kPH+9A85JLO9hLUpRJTBn62UfnuuF92B9CIc6+EewAIqzIn9UoVq2LPA="
59 | ```
60 |
61 | A certificate can be stored in various formats. However, all formats must include:
62 |
63 | - The Bitcoin address: `1H28iygiKXe3GUMcD77HiifVqtf3858Aft`
64 | - The portal type: `web`
65 | - The user name: `hellozeronet`
66 | - The signature from authority: `HA2A+iKekECD3hasrsN8IrR86BnXQ63kPH+9A85JLO9hLUpRJTBn62UfnuuF92B9CIc6+EewAIqzIn9UoVq2LPA=`
67 |
68 | ## Usage in `content.json`
69 |
70 | Site owners can choose which certificate authorities to trust.
71 |
72 | The Blue Hub, for example, accepts certificates signed by ZeroID. This rule is defined in its `data/users/content.json`
73 |
74 | - The ID provider has a friendly name: `zeroid.bit`
75 | - The public key digest of the ID provider is: `1iD5ZQJMNXu43w1qLB8sfdHVKppVMduGz`
76 |
77 | ```json
78 | "user_contents": {
79 | "cert_signers": {
80 | "zeroid.bit": [
81 | "1iD5ZQJMNXu43w1qLB8sfdHVKppVMduGz"
82 | ]
83 | }
84 | }
85 | ```
86 |
87 | Every user presents his certificate in the manifest file in his Bitcoin folder. For example, `data/users/1J3rJ8ecnwH2EPYa6MrgZttBNc61ACFiCj/content.json` says:
88 |
89 | ```json
90 | {
91 | "address": "1BLueGvui1GdbtsjcKqCf4F67uKfritG49",
92 | "cert_auth_type": "web",
93 | "cert_sign": "HPiZsWEJ5eLnspUj8nQ75WXbSanLz0YhQf5KJDq+4bWe6wNW98Vv9PXNyPDNu2VX4bCEXhRC65pS3CM7cOrjjik=",
94 | "cert_user_id": "nofish@zeroid.bit",
95 | "files": {
96 | "data.json": {
97 | "sha512": "8e597412a2bc2726ac9a1ee85428fb3a94b09f4e7a3f5f589119973231417b15",
98 | "size": 21422
99 | }
100 | },
101 | "inner_path": "data/users/1J3rJ8ecnwH2EPYa6MrgZttBNc61ACFiCj/content.json",
102 | "modified": 1492458379,
103 | "signs": {
104 | "1J3rJ8ecnwH2EPYa6MrgZttBNc61ACFiCj": "G8kaZIGAstsiWLVY20e2ogJQi4OO+QuwqJ9GTj3gz7YleST/jst7RQH7hDn0uf8BJMBjFs35H3LPhNHHj4jueh8="
105 | }
106 | }
107 | ```
108 |
109 | Site specific:
110 |
111 | - Expected site URL: `"address": "1BLueGvui1GdbtsjcKqCf4F67uKfritG49"`
112 | - Expected file path: `"inner_path": "data/users/1J3rJ8ecnwH2EPYa6MrgZttBNc61ACFiCj/content.json"`
113 |
114 | Certificate information:
115 |
116 | - ID provider: `zeroid.bit`
117 | - User name: `nofish`
118 | - User Bitcoin address: `1J3rJ8ecnwH2EPYa6MrgZttBNc61ACFiCj`
119 | - Portal type: `web`
120 | - Signature from ID provider: `HPiZsWEJ5eLnspUj8nQ75WXbSanLz0YhQf5KJDq+4bWe6wNW98Vv9PXNyPDNu2VX4bCEXhRC65pS3CM7cOrjjik=`
121 |
122 | ### The verifying process
123 |
124 | 1. The verifying algorithm reads `data/users/content.json` to determine what is the expected site for the user content.
125 |
126 | 2. The verifying algorithm reads `data/users/content.json` to look up the public key digest of the ID provider.
127 |
128 | 3. Given a user Bitcoin address, a portal type and a user name, the verifying algorithm reconstructs the body of the certificate.
129 |
130 | 4. The verifying algorithm checks the signature from the ID provider, with the public key defined in `data/users/content.json`, to ensure the authenticity of the certificate body.
131 |
132 | 5. The verifying algorithm loads the user public key and checks the authenticity of the user content.
133 |
134 | ## Features and limitations of certificate authorities
135 |
136 | - A certificate authority provides memorizable names for user public key digests. It also helps mitigate spam and unsolicited content.
137 |
138 | - A user does not have to give away secret information such as passwords. In addition, a user only has to authenticate once.
139 |
140 | - A certificate authority does not have to be approved by any ZeroNet developers. A site owner can choose which certificate authorities to trust for the sake of user content quality.
141 |
142 | - A certificate authority is responsible for maintaining its user name pool.
143 |
144 | - ZeroID does not revoke or renew certificates.
145 |
146 | ## Can I live without certificate authorities?
147 |
148 | Generally, a certificate is required when you add things to someone else's site. You do not need a certificate when you are modifying your own site.
149 |
--------------------------------------------------------------------------------
/docs/en/site_development/dbschema_json.md:
--------------------------------------------------------------------------------
1 | # Structure of dbschema.json
2 |
3 | [Example dbschema.json file](https://github.com/HelloZeroNet/ZeroTalk/blob/master/dbschema.json)
4 |
5 | The code below will do the following:
6 |
7 | - If an updated data/users/*/data.json file is received (eg.: a user posted something):
8 | - Every row in `data["topics"]` is loaded to the `topic` table
9 | - Every key in `data["comment_votes"]` is loaded to the `comment_vote` table as `comment_hash` col and the values stored in same line as `vote`
10 | - If an updated data/users/content.json file is received (eg.: new user created):
11 | - The `"user_id", "user_name", "max_size", "added"` key in value of `content["include"]` is loaded into the `user` table and the key is stored as `path`
12 |
13 | > Note: [Some restriction](content_json/#regular-expressions-limitations) apply to regular expressions to avoid possible ReDoS vulnerability.
14 |
15 | ```json
16 |
17 | {
18 | "db_name": "ZeroTalk", # Database name (only used for debugging)
19 | "db_file": "data/users/zerotalk.db", # Database file relative to site's directory
20 | "version": 2, # 1 = Json table has path column that includes directory and filename
21 | # 2 = Json table has separate directory and file_name column
22 | # 3 = Same as version 2, but also has site column (for merger sites)
23 | "maps": { # Json to database mappings
24 | ".*/data.json": { # Regex pattern of file relative to db_file
25 | "to_table": [ # Load values to table
26 | {
27 | "node": "topics", # Reading data.json[topics] key value
28 | "table": "topic" # Feeding data to topic table
29 | },
30 | {
31 | "node": "comment_votes", # Reading data.json[comment_votes] key value
32 | "table": "comment_vote", # Feeding data to comment_vote table
33 | "key_col": "comment_hash",
34 | # data.json[comment_votes] is a simple dict, the keys of the
35 | # dict are loaded to comment_vote table comment_hash column
36 |
37 | "val_col": "vote"
38 | # The data.json[comment_votes] dict values loaded to comment_vote table vote column
39 |
40 | }
41 | ],
42 | "to_keyvalue": ["next_message_id", "next_topic_id"]
43 | # Load data.json[next_topic_id] to keyvalue table
44 | # (key: next_message_id, value: data.json[next_message_id] value)
45 |
46 | },
47 | "content.json": {
48 | "to_table": [
49 | {
50 | "node": "includes",
51 | "table": "user",
52 | "key_col": "path",
53 | "import_cols": ["user_id", "user_name", "max_size", "added"],
54 | # Only import these columns to user table
55 | "replaces": {
56 | "path": {"content.json": "data.json"}
57 | # Replace content.json to data.json in the
58 | # value of path column (required for joining)
59 | }
60 | }
61 | ],
62 | "to_json_table": [ "cert_auth_type", "cert_user_id" ] # Save cert_auth_type and cert_user_id directly to json table (easier and faster data queries)
63 | }
64 | },
65 | "tables": { # Table definitions
66 | "topic": { # Define topic table
67 | "cols": [ # Cols of the table
68 | ["topic_id", "INTEGER"],
69 | ["title", "TEXT"],
70 | ["body", "TEXT"],
71 | ["type", "TEXT"],
72 | ["parent_topic_hash", "TEXT"],
73 | ["added", "DATETIME"],
74 | ["json_id", "INTEGER REFERENCES json (json_id)"]
75 | ],
76 | "indexes": ["CREATE UNIQUE INDEX topic_key ON topic(topic_id, json_id)"],
77 | # Indexes automatically created
78 |
79 | "schema_changed": 1426195822
80 | # Last time of the schema changed, if the client's version is different then
81 | # automatically destroy the old, create the new table then reload the data into it
82 |
83 | },
84 | "comment_vote": {
85 | "cols": [
86 | ["comment_hash", "TEXT"],
87 | ["vote", "INTEGER"],
88 | ["json_id", "INTEGER REFERENCES json (json_id)"]
89 | ],
90 | "indexes": ["CREATE UNIQUE INDEX comment_vote_key ON comment_vote(comment_hash, json_id)", "CREATE INDEX comment_vote_hash ON comment_vote(comment_hash)"],
91 | "schema_changed": 1426195826
92 | },
93 | "user": {
94 | "cols": [
95 | ["user_id", "INTEGER"],
96 | ["user_name", "TEXT"],
97 | ["max_size", "INTEGER"],
98 | ["path", "TEXT"],
99 | ["added", "INTEGER"],
100 | ["json_id", "INTEGER REFERENCES json (json_id)"]
101 | ],
102 | "indexes": ["CREATE UNIQUE INDEX user_id ON user(user_id)", "CREATE UNIQUE INDEX user_path ON user(path)"],
103 | "schema_changed": 1426195825
104 | },
105 | "json": { # Json table format only required if you have specified to_json_table pattern anywhere
106 | "cols": [
107 | ["json_id", "INTEGER PRIMARY KEY AUTOINCREMENT"],
108 | ["directory", "TEXT"],
109 | ["file_name", "TEXT"],
110 | ["cert_auth_type", "TEXT"],
111 | ["cert_user_id", "TEXT"]
112 | ],
113 | "indexes": ["CREATE UNIQUE INDEX path ON json(directory, site, file_name)"],
114 | "schema_changed": 4
115 | }
116 | }
117 | }
118 | ```
119 |
120 | ## Example for data.json file
121 | ```json
122 | {
123 | "next_topic_id": 2,
124 | "topics": [
125 | {
126 | "topic_id": 1,
127 | "title": "Newtopic",
128 | "body": "Topic!",
129 | "added": 1426628540,
130 | "parent_topic_hash": "5@2"
131 | }
132 | ],
133 | "next_message_id": 19,
134 | "comments": {
135 | "1@2": [
136 | {
137 | "comment_id": 1,
138 | "body": "New user test!",
139 | "added": 1423442049
140 | }
141 | ],
142 | "1@13": [
143 | {
144 | "comment_id": 2,
145 | "body": "hello",
146 | "added": 1424653288
147 | },
148 | {
149 | "comment_id": 13,
150 | "body": "test 123",
151 | "added": 1426463715
152 | }
153 | ]
154 | },
155 | "topic_votes": {
156 | "1@2": 1,
157 | "4@2": 1,
158 | "2@2": 1,
159 | "1@5": 1,
160 | "1@6": 1,
161 | "3@2": 1,
162 | "1@13": 1,
163 | "4@5": 1
164 | },
165 | "comment_votes": {
166 | "5@5": 1,
167 | "2@12": 1,
168 | "1@12": 1,
169 | "33@2": 1,
170 | "45@2": 1,
171 | "12@5": 1,
172 | "34@2": 1,
173 | "46@2": 1
174 | }
175 | }
176 | ```
177 |
178 | ## Example for content.json file
179 |
180 | ```json
181 | {
182 | "files": {},
183 | "ignore": ".*/.*",
184 | "includes": {
185 | "13v1FwKcq7dx2UPruFcRcqd8s7VBjvoWJW/content.json": {
186 | "added": 1426683897,
187 | "files_allowed": "data.json",
188 | "includes_allowed": false,
189 | "max_size": 10000,
190 | "signers": [
191 | "13v1FwKcq7dx2UPruFcRcqd8s7VBjvoWJW"
192 | ],
193 | "signers_required": 1,
194 | "user_id": 15,
195 | "user_name": "meginthelloka"
196 | },
197 | "15WGMVViswrF13sAKb7je6oX3UhXavBxxQ/content.json": {
198 | "added": 1426687209,
199 | "files_allowed": "data.json",
200 | "includes_allowed": false,
201 | "max_size": 10000,
202 | "signers": [
203 | "15WGMVViswrF13sAKb7je6oX3UhXavBxxQ"
204 | ],
205 | "signers_required": 1,
206 | "user_id": 18,
207 | "user_name": "habla"
208 | }
209 | }
210 | }
211 | ```
212 |
--------------------------------------------------------------------------------
/docs/en/site_development/getting_started.md:
--------------------------------------------------------------------------------
1 | # Getting Started
2 |
3 | ZeroNet allows you to publish static and dynamic websites on a distributed web platform.
4 |
5 | In ZeroNet there is no concept of servers. Thus, server-side languages like PHP or Ruby are not needed. Instead, one can create dynamic content using ZeroNet's API (called ZeroFrame), JavaScript (or CoffeeScript) and the SQL database provided to all websites.
6 |
7 | ## Tutorials
8 |
9 | ### ZeroChat tutorial
10 |
11 | In this tutorial we are going to build a P2P, decentralized, server-less chat site in less then 100 lines of code.
12 |
13 | * [Read on ZeroBlog](http://127.0.0.1:43110/Blog.ZeroNetwork.bit/?Post:99:ZeroChat+tutorial)
14 | * [Read on Medium.com](https://decentralize.today/decentralized-p2p-chat-in-100-lines-of-code-d6e496034cd4)
15 |
16 | ## Useful Information
17 |
18 | ### ZeroNet Debug mode
19 |
20 | ZeroNet comes with a `--debug` flag that will make site development easier.
21 |
22 | To run ZeroNet in debug mode use: `python zeronet.py --debug`
23 |
24 | If you are using compiled/bundled version of ZeroNet:
25 |
26 | * On Windows: `lib\ZeroNet.cmd --debug`
27 | * On Linux: `./ZeroNet.sh --debug`
28 | * On Mac: `./ZeroNet.app/Contents/MacOS/ZeroNet --debug`
29 |
30 | #### Debug mode features:
31 |
32 | - Automatic [CoffeeScript](http://coffeescript.org/) -> JavaScript conversion (if a coffeescript compiler is installed)
33 | - Debug messages will appear in the console
34 | - Auto reload of some source files (UiRequest, UiWebsocket, FileRequest) on modification to prevent restarting (Requires [PyFilesystem](http://pyfilesystem.org/) on GNU/Linux)
35 | - `http://127.0.0.1:43110/Debug` Traceback and interactive Python console at the last error position (using the wonderful Werkzeug debugger - Requires [Werkzeug](http://werkzeug.pocoo.org/))
36 | - `http://127.0.0.1:43110/Console` Spawns an interactive Python console (Requires [Werkzeug](http://werkzeug.pocoo.org/))
37 |
38 | ### Writing in CoffeeScript
39 |
40 | To aid in writing CoffeeScript-based ZeroNet sites and to make use of ZeroNet's
41 | built-in CoffeeScript -> JavaScript converter, first enable debug mode as
42 | described in [Debug](#zeronet-debug-mode). Additionally, ensure the site you
43 | wish to work on is marked as one you own by enabling "This is my site" via
44 | the site sidebar.
45 |
46 |
47 | ZeroNet will compile all CoffeeScript files it can find into a file called `all.js`, and deposit it in a `js/` folder at the top level of your site. This file will also include all your JavaScript code as well. Then you can simply import all your dynamic code into your HTML with the following before the `