Skip to content
Super simple social network interaction, where users can post and comment on posts
JavaScript
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
dappchain
webclient
README.md

README.md

Simple Social Network Example

Sample DAppChain showing the integration between LoomProvider, Web3 and Loom.js for a super simple social network interaction, where users can post and comment on posts

The smart contract compiled for this examples uses the Solidity version 0.4.24 (SimpleSocialNetwork.sol)

This example also uses Redis and ElasticSearch to manages a cache layer

Development

1.) Run your own DappChain

Please consult the Loom SDK docs for further instruction on running your own DappChain.

2.) Clone the example project

git clone https://github.com/loomnetwork/solidity-social-example

3.) Start the DappChain

cd solidity-social-example

cd dappchain
wget https://storage.googleapis.com/private.delegatecall.com/loom/osx/build-375/loom
chmod +x loom


# Configure
./loom init
cp genesis.example.json genesis.json

# Run
./loom run

4.) Start ElasticSearch and Redis

Notice that both services are required in order to correct run and interact with the application

# macOS
brew tap homebrew/services
brew install elasticsearch
brew install redis

# Start services on macOS
brew services start elasticsearch
brew services start redis

5.) Start indexer

The indexer.js is a service which will receive all events from the smart contract and feeds a cache layer built on a message queue and a fast database (Redis + ElasticSearch), it also serves the app with a fresh data on the address http://localhost:8081/posts or http://localhost:8081/comments

Note this works best on Node8

brew install node@8
# On second terminal
cd solidity-social-example/webclient
# install
yarn
node indexer.js

6.) Start the web server

Finally we're going to start the webserver which will supply the interface allowing users to interact to the smart contracts on the Loom DappChain

# On third terminal
cd solidity-social-example/webclient

# Install
yarn

# Start the demo
yarn start

7.) Running

The Simple Social Network web interface will be available on http://localhost:8080

Loom Network

https://loomx.io

License

MIT

You can’t perform that action at this time.