Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/likecoin/likecoin-poc
Meme Generator - a proof of concept of LikeCoin content footprint
https://github.com/likecoin/likecoin-poc
ethjs ipfs nodejs
Last synced: about 2 months ago
JSON representation
Meme Generator - a proof of concept of LikeCoin content footprint
- Host: GitHub
- URL: https://github.com/likecoin/likecoin-poc
- Owner: likecoin
- License: gpl-3.0
- Created: 2017-10-20T13:42:56.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2019-02-11T12:21:44.000Z (almost 6 years ago)
- Last Synced: 2024-05-07T12:02:57.894Z (8 months ago)
- Topics: ethjs, ipfs, nodejs
- Language: JavaScript
- Homepage: https://meme.like.co
- Size: 75.2 KB
- Stars: 4
- Watchers: 7
- Forks: 2
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Meme Generator
[![NSP Status](https://nodesecurity.io/orgs/likecoin/projects/a5bea3a5-795d-47a3-9059-c5c9c313e1d3/badge)](https://nodesecurity.io/orgs/likecoin/projects/a5bea3a5-795d-47a3-9059-c5c9c313e1d3)
a proof of concept of LikeCoin content footprint
## Live Demo
https://meme.like.community## Quick startup
- Prepare a ethereum wallet in rinkeby testnet, [make sure you have eth for running smart contracts](https://faucet.rinkeby.io/)
- Replace `address` and `privateKey` field in [config/accounts.js](./config/accounts.js)
- Run `docker-compose up -d`.
It will create a [ipfs container](https://hub.docker.com/r/ipfs/go-ipfs/), a [nginx container](https://hub.docker.com/_/nginx/) and build the `like-server` container.
The `like-server` container contains the production build of the [frontend](https://github.com/lakoo/like-poc-web) and the nodejs api server.## How it works
### `/upload`
POST endpoint for uploading new image file with metadata
- The image fingerprint is generated by puting the uploaded image into `sha256()` function.
- The image is then added to local ipfs by `ipfs.add()`, yielding its ipfs address.
- The fingerprint, ipfs address and other metadata are then written to the smart contract by calling `ethjs-signer` and `sendRawTransaction`.
- The result eth transaction hash is then sent back to frontend for tracking.### `/query/:key`
GET endpoint for query metadata given its fingerprint
- Using `ethjs-contract`, we call `likeContract.get()` with the input key(fingerprint) as the param.
- The result in array format is converted into key-value mapping, then returned to frontend.### `/meme/:key`
POST endpoint for creating meme image base on another existing image with fingerprint
- Similar to query, `likeContract.get()` is called to extract metadata from the fingerprint.
- The actual image data is retrieved by calling `ipfs.cat()` with the ipfs address stored in metadata.
- The image data is then pass to `imageMagick` for annotating text.
- The result of `imageMagick` is then pass to `sha256()` and `ipfs.add()` again for yielding fingerprint and ipfs address.
- The new fingerprint and ipfs address, together with the parent fingerprint contained in the metadata is written into smart contract by `sendRawTransaction()`.
- The result eth transaction hash is then sent back to frontend for tracking.## Smart contract used
[like-media-contracts-poc](https://github.com/lakoo/like-media-contracts-poc)