1
0
forked from apxtri/apxtri

README new

This commit is contained in:
philc 2024-03-18 09:41:58 +01:00
parent b025800e26
commit dbd8cf72a0

245
README.md
View File

@ -1,14 +1,14 @@
## apxtri a Decentralized Autonomous Organisation (DAO)
## apxtri  Decentralized Autonomous Organisation (DAO) for Libertarian
You are here on the tech side, to understand under the wood how it works and how you can contribute to this tech journey.
See [apxtri web site](https://apxtri.crabdance.com) how to create a new social world with apxtri.
## apxtri Architecture a quick view & keywords definition
## apxtri Architecture: a quick view & keywords definition
* **a nation** is a topology network of nodes town that share the same fundamental rules (engrave into a common blockchain).
* **a town** is a physical installation node of a machine (linux server) plug into a LAN network (a telecom box NAT conf) accessible into internet a WAN network (domain name redirect to a town public IP).
* **a town** is a physical installation node of linux server plug into a LAN network (a telecom box NAT conf) accessible from a WAN network (domain name redirect to a town public IP).
* **a tribe** has a unique name and is a space to host data to apply specific algo rule register at the creation of a tribe by a druid that respect the town rules
* **a pagan** 'village farmer' is a unique identification create by anyone based on PGP (public/Private key) and an alis (humanly understandnable) that allow a member to proof that he owns data. Can be anonymous but all his actions are store into a blockchain of reputation.
* **a pagan** 'village farmer' is a unique identification create by anyone based on PGP (public/Private key) and a unique alias (for human) that allow a member to proof that he owns this identity. Can be anonymous but all his actions are store into a blockchain of reputation link to this unique ID.
* **a druid** 'rules master' is a pagan that owned and defined rules of a tribe, he owns a domain name (DNS) to make it tribe's data accessible over the net. As pagan he can be anonymous, he is responsible of the tribe activities and can ban a pagan of his tribe. Any pagan become a druid when he decides to create a tribe by requesting a town mayor
* **a mayor** is a owner of a physical machine, he is in charge to make a town node working (IP availibily) and accept to be part of a nation (rules of the blockchain nation).
* **a contract** is an algorythme that is written into the blockchain and will be run if an action trig. Immutable contract are the one link to the blockchain. Any pagan/druid/major can defined a contract that apply to other pagans.
@ -19,88 +19,191 @@ All actors will have the same target to respect contracts and are free to leave
```plaintext
/town-nation/
apxtrib/ core system that manage used tribe adminapi referential endepoint https://.../api/routeName/...
/middlewares
/models
/lg refName.json {msgkey:mustache template}
/routes endpoint that return {status,ref,msg,data}
/setup conf template to start a new town
apxtri.js starting point
package.json
/conf/townconf.json town conf express.js
/nginx/tribe_website.conf nginx conf per website
/nationchains/
/nations/ common blockchain rules per nation
/towns/ nodes server
/pagans/ anonymous numerique identity
/blocks/ blockchain database
/tribes/ tribe's files space
/idx/
/itm/admin.json
/adminapi/ Allow apxtribe management
/schema/ list of schemaName.json
/schema/lg list of schemaName_lg.json language data
/objects/idx/ list of indexName.json
/itm/ list of object content store by apxid.json
/www/cdn web public access file
/adminapx/index_lg.html administration webapp
/website/
/tribeName/
/api/routes Specific web service https://.../api/tribename/routeName/endpoint
/middlewares
/models
/schema list of t
/tmp/tokens/ manage temporary keys
/tmp/tokens temporary files
/tribes/ tribe's space
/idx/
/itm/admin.json tribe conf are store
tribeName.json
/adminapi/ Allow apxtribe management
/apxtri/ core system that manage used tribe adminapi referential endepoint https://.../api/routeName/...
/middlewares
/models
/routes endpoint that return {status,ref,msg,data}
apxtri.js starting point
package.json
/schema/ list of schema for ObjectName.json title description coments are in english
/lg list of schema ObjectName_lg.json per language data (same structure than ObjectName.json but in language lg)
/objects/objectName/idx/ list of indexName.json
/itm/ list of object content store by apxid.json (unique key to identify an ite in a collection of items object
/pagans Unique numeric ID shared accross all node (towns)
/towns Unique town name shared accross all node by domain name + IP
/
/www/cdn web public access file
/adminapx/index_lg.html administration webapp
/website/
/tribeName/
/api/routes Specific web service https://.../api/tribename/routeName/endpoint
/middlewares
/models
/schema/
/objects/
/www/
...
```
## Network topology
 As it is decentralize organisation, a public address directory is replicated on each instance of a town into /nationchains .
 
Each town (instance) is accessible with an anonymlous DNS https://apxtri.crabdance.com where the IP adresse is update when elected town's IP to register a new block into the blockchain (each 10minutes).
 As it is decentralize organisation, a public address directory  is replicated on each instance. We strongly recommand to use many reverse proxy to manage your public IP, never exposed your physical real IP in your country for anonymous target. 
 Each town (instance) is accessible with an anonymlous DNS https://apxtri.crabdance.com where the IP adresse is update when elected town's IP to register a new block into the blockchain (each 10minutes).
## Quick start:
Pre-request: linux maxhine (ubuntuserver swith sudoer apx)
Pre-request: linux maxhine on a vps or physical machine ( we choose ubuntu server > 20, adapt this if you want to use something else).
1.  sudo apt install nginx 
To start you need to 
## apxtri Documentation
* setup your network and for production a Domain Name server and a SSL certificat to your IP town
* setup your machine by installing smap, nginx, nvm, npm, node
**Documentation for apxtri usage to start**, tuto HOW TO for user, dev ... is [here](https://apxtri.org/doc)
As a mayor, you have to understand what you are doing, your numeric reputation is in the game. Always check sources before downloading any things. For dev use town name: **dev** and nation name :**ants** 
* [Set up](https://gitea.ndda.fr/apxtri/apxtri/wiki/Setup)
* [Manage users](http://gitlab.ndda.fr/philc/apxtri/-/wikis/HOWTOuser)
* [Manage multilangue referentials](http://gitlab.ndda.fr/philc/apxtri/-/wikis/HOWTOreferential)
* [How to manage trigger action](http://gitlab.ndda.fr/philc/apxtri/-/wikis/HOWTOtriggeraction)
### Network: 
To quickly test we recommand you to "Set up for dev", you just need an linux desktop and it rocks...
Read more on the wiki's project [apxtri wiki](http://gitlab.ndda.fr/philc/apxtri/-/wikis/home)
FOR DEV:  you can just use local http:/dev-ants
**Documentation for apxtri dev** is done into the gitea wiki project.
You will find anything to understand how it works under the wood. Feel free to ask question, comment to improve the code. If you need to debug or you want to add a main feature setup your machine as local (no exchange with the blockchain)
```plaintext
$ sudo vim /etc/hosts # add 127.0.0.1 dev-ants
# Then after "Machine" install, open in your browser http://dev-ants
```
* [Nations -> Towns -> Tribes -> Pagans Architecture](https://gitea.ndda.fr/apxtri/apxtri/wiki/HardwareNation) the social world
* nationchains the blockchain and social contracts between mpayor, druids and pagans.
* package.json and tribes/townconf.js setup and convention rules: eslint, unit test, multi-lang, header
* middleware/route/Models restfullapi logical from routes to middleware to models to datamapper and result res.status(http code).json({data,info,moreinfo})
* accessrights Access right definition on object (Object,...)
* Odmdb.js convention for object descriptor manager to index, search, create, update, delete item of an Object collections (to simplify CRUD actions for Models)
* Pagans.js decentralized and anonymous publicKey for a pagan based on PGP with accessright onto other objects. Authentification process and localStorage management of 24 hours JWT. Login/psw/email.
* Tribes.js A Druid space to host a web space.
* Tags.js Event trackers to log any usefull event that can be used into sodial contracts
* Messages.js Notification (delete after read) and message between any interactions concerning pagans (1 to many or 1 to 1), trig by social contract or by a pagan
Setup.js Technical infrastructure an
* Blockchains and Contracts Contracts.js
FOR PRODUCTION: 
**ROADMAP**
You need a domain name, to get a free one [http://ydns.io](http://ydns.io) create one like apxtri.ydns.io that content your IP adress the get your url update something like [https://ydns.io/hosts/update/Tl7FDQAETmQre312edztgsI](https://ydns.io/hosts/update/Tl7FDQAETmQre312edztgsI)[Uy](https://ydns.io/hosts/update/Tl7FDQAETmQre312edztgsIUy)
* Setup process to review to simplify Town setup dev and setup prod that create 1 tribe with name town, with 1 pagan set with the role of druid of the tribe and mayor of the town.
* Decentralized social Data model based on schema.org + data type definition and integrity check + metadata
* GUI for mayor to create new tribe and manage druid and payment space (based on bitcoin wallet)
* GUI for druid to manage space storage (publish a web site, manage media storage)
* Plugins process to share tribe route / Model for specific app
* Decentralized social Contracts nationschains in socialworld/contracts list of contracts
```plaintext
# Into your production machine
$ crontab -e
# add a line at the end to update your IP in case you have a dynamic WAN IP
1,6,11,16,21,26,31,36,41,46,51,56 * * * * sleep 38 ; wget --no-check-certificate -O - https://ydns.io/hosts/update/Tl7FDQAETmQre312edztgsIUy >> /tmp/apxtri_ydns.io.log 2>&1 &
$ ip -4 address # to get your (local) LAN IP of your server
```
Connect in your browser to your box (use your LAN IP and change last number by 1) Set as a dmz your local LAN IP and route (NAT) your internet trafic port 80 and 443 to this local IP.
This allow public access from internet to your DMZ local server.  Think to use reverse proxy to be more anonymous. Contacts the community to help keeping your anonymous.
### Machine: 
use a sudoer user and execute command line $, for security reason, do not use apxuser replace it by something not common (as admin, mayor,… use your nickname or pseudo)
```plaintext
$ sudo apt update
$ sudo apt upgrade
$ useradd -s /bin/bash -m -d /home/apxuser -c "apxuser" apxuser
$ passwd apxuser
$ sudo usermod -aG sudo apxuser
$ sudo visudo
# add the next line in the file
$ apxuser ALL=(ALL) NOPASSWD: ALL
# exit and save
$ su apxuser
$ sudo apt install git vim libcap2-bin p7zip-full p7zip-rar curl nginx
# Install last nvm** (check website to get latest v0.xx from https://github.com/nvm-sh/nvm)
$ curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash
# close and re-open terminal under apxuser
$ nvm --version
# if nvm not found then cc paste 3 last line : export NVM_DIR= ....
# and recheck nvm --version
# Install node/npm/yarn in general follow the directiv they gave online to update properly the config
$ nvm install node
$ node --version #to check
$ npm install --global yarn
$ yarn --version
$ mkdir ~/apxtowns | mkdir ~/apxtowns/town-nation
#################################
# For dev #######################
#################################
# you only need to clone the apXtri project in ~/apxtowns/town-nation/tribes/adminapi/, this allow you push features to the maintainers of the project:
$ curl -L https://wall-ants.fr/cdn/setupdev.tar | tar -xvzf - -C ~/apxtowns/town-nation/
$ cd ~/apxtowns/town-nation/tribes/adminapi/
$ git clone https://gitea.ndda.fr/apxtrib/apxtri.git
$ yarn install
$ town=dev nation=ants dns=dev-ants yarn dev # for 1st install to set conf/nginx/adminapi_adminapx.conf with your parameter
#################################
# For production ###############
#################################
# rename your machine not mandatory but usefull
$ sudo vim /etc/hostname #replace name by town-nations
$ sudo vim /etc/hosts # replace previous hostname by town-nations
$ sudo reboot
# ssl cerificat management for https
$ sudo snap install core
$ sudo snap refresh core
$ sudo apt remove certbot
$ sudo snap install --classic certbot
$ sudo ln -s /snap/bin/certbot /usr/bin/certbot
$ curl -L https://wall-ants.ndda.fr/cdn/setup.tar | tar -xvzf - -C ~/apxtowns/town-nation/ | cd ~/apxtowns/town-nation/tribes/adminapi/ | yarn install
$ town=townname nation=nationname dns=apxtri.ydns.io yarn startapx # for 1st install to set conf/nginx/adminapi_adminapx.conf with your parameter
$ yarn restartapx # if IT IS NOT a first install
# open a browser and type https://domain to access to your admin console
# To set autostart in case of reboot
$ yarn pm2 list # To check if all is fine
$ yarn pm2 startup # If needed it will request from you to run a command
$ sudo env PATH=$PATH:/home/apxuser/.nvm/versions/node/v17.3.0/bin /home/apxuser/apxtowns/town-nation/tribes/adminapi/apxtri/node_modules/pm2/bin/pm2 startup systemd -u apxuser --hp /home/apxuser
# To stop autostart
$ yarn pm2 unstartup ; in case of error follow the command line provide like)
$ sudo env PATH=$PATH:/home/apxuser/.nvm/versions/node/v17.3.0/bin /home/apxuser/apxtowns/town_nation/tribes/adminapi/apxtri/node_modules/pm2/bin/pm2 unstartup systemd -u apxuser --hp /home/apxuser
# As mayor you need to own this town as yours by conecting to https://dns
```
## apxtri Documentations
### Documentation for developper: 
apxtri core : https://dns/cdn/apidoclist all endpoint and how authentification and data object management works.
* anonymous numeric identity with **pagan** object that allow a unique alias and publickey
* how a pagan can become a **person** for a trib (anonymously or not)
* how notification can cypher message between 2 pagans to communicate
* how a dev can create and host a tribe and a full project with api backend (documented with apidoc) and a webapp (in react, vue, angular, or a simple web page)
### Main end-point:
* Odmdb : data model management and accessright
* Pagans : numeric Identity with person to join a tribe
* Notifications: Exchange secure  message between Pagans and machine (alert,…)
* Tribes; crud a tribe for a druid
* Trackings: nginx watching to manage security and ban unwanted user from ennemy's IP (non libertarian user)
* Middleware: to manage authentification and data accessright process.
* Blockchain: to synchronize common data and manage contracts between Pagans (as well than managing  an api crypto wallet)
* Multilanguage management
### Documentation for mayor and druid:
A webapp allow you to manage a town as mayor or as a druid access it and authentify you on https://dns/ 
## ROAD MAP
If you want to join our task force to make this libertarian project live feel free to contact us on discord in apXtri server 
We are looking for dev (node.js, express.js, js, web developper), for translator, for trainner, for mayor and druid from any countries  that want developp a business with their machine/bandwisdth annd a client community.
Dev
* Dev a front end to manage apXtri for druid and mayor (CRUD a town a tribe)
* Dev a synchronization process between node (towns) to load balance and make uncensurable druid web space
* Dev contracts / crypto with a wallet for a mayor to sale crypto againt fiat currecny and allow a druid to rent anonymously web space.
* Dev a marketplace front to share objects (product or service) between any pagans / persons by inverting the process of  offer / demand
Community managers and user
* animate the apXtri discord and social network to dev the user community
* translate content app for italian, german, spanish, 
* creator or producer of any valueable stuff to sale/exchange any things into your community