Publish research for free, access research for free.
Downloadable Aletheia App
About
Decentralisation
Decentralisation, as stated on Wikipedia, is the process of redistributing or dispersing functions, powers, people or things away from a central location or authority. While centralization, especially in the governmental sphere, is widely studied and practiced, there is no common definition or understanding of decentralization. The meaning of decentralization may vary in part because of the different ways it is applied. Concepts of decentralization have been applied to group dynamics and management science in private businesses and organizations, political science, law and public administration, economics and technology.
Aletheia is technology, but using a broad definition of decentalisation rather than in a specifically technological one is a deliberate choice because Aletheia isn't just technology, it's also community. Decentralisation is as desirable state because it is strong. No single point of failure means it’s very hard for a system to collapse through neglect or to be taken down by a malicious actor. No single point of control means the system cannot be controlled by vested interests. Utilising decentralisation is an attempt to build a truly free and incorruptible system, a system that can be applied to, but also be applied past technology.
Why a downloadable app?
This is one of the ways Aletheia manifests its decentralised nature, by residing on a number of inividual computers across potentially a hundred or more legal jurisdictions. If Aletheia was a web platform it would be vulnerable because a website can be blocked, a website can be taken down, the server hosting the website could be physically damaged, it can have its contents deleted or can be turned off. A website is a single point of failure. Mirroring websites can only do so much. Try turning off, deleting the contents of, or destroying hundreds of computers in hundreds of different countries, it's much harder. By the same token, control of a website could be obtained through financially acquiring the domain name, acquiring the website host, acquiring the server or the data centre it resides in. Obtaining control of hundreds of personal computers spread across the globe is much more difficult, meaning in both cases, the degree to which Aletheia can be assailed and controled by malicious actors is lowered. Decentralisation is strength.
Ethereum
Ethereum is a blockchain technology for agreeing on data and logic in a completely decentralised way. Ethereum will be used to manage rules about which documents are approved by the network. Ethereum uses solidity smart contracts which are stored in the /contracts directory.
Truffle
Truffle is a framework for developing, testing and deploying Ethereum contracts.
Filesharing
IPFS is a peer to peer filesharing technology similar to bittorrent. A core aspect of aletheia will be a private ipfs network which shares only the files which have been approved by the community. Currently we simply use the public IPFS network to share files.
Livenet vs Testnet vs Development
Despite using the Ethereum code, we do not have to use the main ethereum blockchain. To keep costs down we plan on going live with a sperate blockchain.
For local development, a blockchain can be faked using testrpc. For public testing a testnet is being deployed for testing interactions between multiple aletheia clients.
Electron
Electron is a framework for developing cross platform applications with HTML and JavaScript. main.js bootstraps the app, each page is then self contained within the ./app directory. In future we may add a javascript UI framework such as react or angular.
Requirements
Nodejs 6+
Python 2 (not python 3) test this with python --version
A running local IPFS node
A running ethereum node. Recommended to use testrpc for local development and geth for the testnet
OSX instructions
git clone https://github.com/aletheia-foundation/aletheia-app.git
cd aletheia-app
# note, this is not strictly required for local development as the fake ethereum client `testrpc` can be used.
brew install ethereum # installs geth
brew install nodejs
# OSX should have python 2.X pre installed
npm install -g electron
Ubuntu instructions
These instructions were tested on ubuntu 16.10
git clone https://github.com/aletheia-foundation/aletheia-app.git
cd aletheia-app
# this installs nodejs 6.x, geth and electron
sudo ./scripts/install-ubuntu.sh
Run project in web browser
Clone this repo and cd into its directory
This project requires IPFS and Ethereum clients to be running in the background
# open three terminal tabs in the project folder:# in tab 1
npm config set python $(which python)# Python 2 is needed, not python 3
npm install
npm run ethereum-local
# in tab 2 (must be in project directory)
npm run ipfs-local
# in tab 3 (must be in project directory)
npm run start:web # (app will start but be unable to connect to filesharing or blockchain)
Test the app build on the testnet
npm run electron:serve
note: this will not be able to connect to the local ethereum testrpc (npm run ethereum-local)
and can only be tested on the real testnet e.g.:
# In tab 1
npm run ethereum-testnet
# in tab 2
npm run ipfs-local
# In tab 3
npm run electron:serve
Test the dist build
You can also generate the actual executables for different platforms with
npm run electron:linux
npm run electron:windows
npm run electron:mac
Note: The video mentions installing/running the project on Mac OS. The steps followed in the video are also applicable to any Linux distribution (Ubuntu, CentOS, ...).
Tests
Linting
npm run lint
Tests run in a browser with karma.
npm run test:js
Smart contract tests with truffle
# in tab 1
npm run ethereum-local
# in tab 2
npm run test:truffle
Testing notes
Test data
npm run test-data
Start the app with another user
ACCOUNT_NUMBER=1 npm run start
Force mine a block
Call this from debugger window:
web3.currentProvider.sendAsync({jsonrpc: "2.0",method: "evm_mine",id: 12345},function(err,result){// this is your callback});
请发表评论