EDIchain
Provides a basic integration for ipfs (storage/distribution) and ethereum blockchain (validation/authorization) based EDI message exchange. All messages are transactions represented within the blockchain. Message data is always encrypted an is not part of the blockchain transaction. Instead a hash of the encrypted content is published into the blockchain. Message data/content is distributed via ipfs.
- Encrypted P2P Data exchange that require transaction proof (consens of transactions)
- High-End scalability due to P2P architecture for content distribution
- Easy integration into existing backend systems (like EDIFact)
- Try to do a kind of Plug and Play ... (Auto-Register, Auto-Config...)
Demo
There is a cloud demo available at http://139.59.212.222:8088/ - However this is an unprotected environment to quickly see what this package/module is about.
Installation
npm install edichain --save
cd node_modules/edichain
npm start
Requirement
Requires ipfs daemon to be started.
ipfs daemon
Requires geth to be started and synced blockchain.
geth --rpc --unlock "0x12345678..." --rpcapi "eth,net,web3,personal" --rpcaddr "localhost" --rpcport "8545" console
Usage
As module
Basic
var { // YOUR Code to interact } var config = bootstrap_callback:cb var echain = config;
As JSON-RPC2 service
Namespace: edichain
Exposed Methods
sendEdi |
receivedMessageCount |
sentMessageCount |
decryptMessageByNumber |
decryptSentByNumber |
getMessageByNumber |
getSentByNumber |
chainAccount |
ackMessageByAddr |
getTxLog |
getAck |
Configuration Options
bootrap_callback | Required | Your Callback function to be called as soon as startup is completed |
fromAddress | Optional | Ethereum address to be opened (Default: Account 0) |
pwd | Required (if locked) | Password to unlock account |
ipfsAPI | Optional | IPFS API (Default: /ip4/127.0.0.1/tcp/5001 ) |
rpcProvider | Optional | GETH RPC Interface (Default: http://localhost:8545 ) |
Known Limitations
- Runtime should not exceed 1 day as geth account unlock is limited to 86400 seconds
- Account create is not implemented. You might use MIST to create your Ethereum account
Examples
Sending Data to (registered) Ethereum Account
edichain;
What happens in the background:
- Check if recipient "0x97..." is registered
- Fetch public key of recipient via ipfs using hash provided by registrar contract in blockchain
- Encrypt Data and store it as ipfs object
- Send message with hash to stored object to recipient (using registrar)
Checking and updating inbox
edichain; // Checks Blockchain for updates // edichain.messages[] holds all messages received (inc. data) // Sample on how to use messages array ;
How messages get processed:
- Check with registrar for new messages
- Retrieve address of message contract
- Retrieve hash with data using IPFS
- Decrypt message and validate sender
- Update Messages array
Transaction Log
In EDI it is all about securing transactions. In this aspect all operations this script does are visible within the blockchain.
edichaintxlog;
Internally this script is using winston as logger and creates a tx.log file containing all transactions for auditing.
Contributing
Release History
- 0.0.21 Added Transaction View
- 0.0.11 Added JSON-RPC2 Interface as sample implementation
- 0.0.10 Maintainance Release (Fix Issue #2)
- 0.0.9 Encapsulated IPFS cloud WORM in order to allow providers as alternative
- 0.0.5 Updated Logger, several fixes in message handling
- 0.0.1 Initial release