Espace Files is a proof of concept for hybrid decentralization in file storage services, which utilizes the Ethereum blockchain and IPFS.
By combining the benefits of centralization (security and speed) with those of decentralization (non-deletable and incorruptible data), hybrid decentralization allows us to store a file in the IPFS network with the Ethereum blockchain for life, while also enabling fast and secure access.
Decentralization involves:
- Using the InterPlanetary File System (IPFS) network to save file contents, which are encrypted using the AES 256 algorithm.
- Storing IPFS CID in an Ethereum blockchain as a smart contract (File.sol).
The (PostgreSQL database) is used solely to store file encryption data, such as authentication tags, keys, and salts. Please note that the encryption data itself is encrypted in the database using PGP symmetric key.
Use JSON Web Token (HMACSHA512) with an expiration time of 10 hours.
The Storage Service is an Espace Files SaaS API that uses an API Auth/Key combination.
Name | Description | Example |
---|---|---|
ETH_BLOCKCHAIN_ADDRESS |
Ethereum Goerli testnet blockchain HTTP address | http://localhost:8545 |
ETH_ACCOUNT |
Ethereum Goerli testnet account address | 0x12... |
ETH_ACCOUNT_MNEMOMIC |
Ethereum Goerli testnet account mnemonic | planet sentence ... |
INFURA_IPFS_API_KEY |
IPFS Infura project API key | xxx |
INFURA_IPFS_API_KEY_SECRET |
IPFS Infura project API key secret | xxx |
DATABASE_URL |
PostgreSQL Database URL | postgres://postgres:root@localhost:5432/espacefiles |
DATABASE_ENCRYPTION_KEY |
PostgreSQL PGP symmetric key used to encrypt/decrypt data related to files encryption | random12345 |
DATABASE_ENCRYPTION_ALT_KEY |
PostgreSQL PGP symmetric key used to encrypt/decrypt data related to Storage Service | random12345 |
JWT_KEY |
Key used for JSON Web Token signing | random12345 |
CORS_URL |
Cross-origin resource sharing allowed origin | https://example.com |
PORT |
HTTP Server port | 8080 |
To use the PostgreSQL database, please complete the DDL available in database/ddl.sql
- Install dependencies
$ npm ci
-
Run Blockchain in local
- Download https://www.trufflesuite.com/ganache (recommended)
- Or using
ganache-cli
:$ npm install -g ganache-cli && ganache-cli
-
Compile and migrate Solidity smart contracts
$ truffle compile && truffle migrate
-
Set up DDL in your database, see database/ddl.sql
-
Launch server
$ npm run start:dev
- Install dependencies
$ npm ci
- Run tests
$ npm run test
- Compile and migrate Solidity smart contracts
$ truffle compile && truffle migrate --network goerli
-
Set up DDL in your database, see database/ddl.sql
-
Launch server (using PM2)
$ pm2 start npm --name "api" -- run "build_and_start:prod"
- Access to PM2
$ pm2 monit
This project is licensed with GNU AGPL v3 License.
See LICENSE for more details.