Giter Club home page Giter Club logo

solidity-social-example's Introduction

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

solidity-social-example's People

Contributors

mattkanwisher avatar eduardonunesp avatar

Watchers

James Cloos avatar Evan avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.