https://github.com/loomnetwork/solidity-social-example
Super simple social network interaction, where users can post and comment on posts
https://github.com/loomnetwork/solidity-social-example
Last synced: 5 months ago
JSON representation
Super simple social network interaction, where users can post and comment on posts
- Host: GitHub
- URL: https://github.com/loomnetwork/solidity-social-example
- Owner: loomnetwork
- Created: 2018-05-29T01:09:52.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2019-05-13T12:52:07.000Z (about 7 years ago)
- Last Synced: 2024-12-06T17:15:44.084Z (over 1 year ago)
- Language: JavaScript
- Homepage:
- Size: 17.3 MB
- Stars: 69
- Watchers: 7
- Forks: 18
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Simple Social Network Example
Sample DAppChain showing the integration between LoomProvider, Web3 and [Loom.js](https://github.com/loomnetwork/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](https://loomx.io/developers/docs/en/prereqs.html) for further instruction on running your own DappChain.
### 2.) Clone the example project
```bash
git clone https://github.com/loomnetwork/solidity-social-example
```
### 3.) Start the DappChain
```bash
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
```bash
# 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
```
```bash
# 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
```bash
# 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](https://loomx.io)
License
----
MIT