You can find the memechain-api GitHub source here.
You can find instructions on how to install and run a memechain-node here.
MemeChain Design Introduction
The MemeChain draws inspiration from a few notable blockchain projects, namely Radium's SmartChain software and Blockstack's VirtualChain. It has been independently developed from the ground up to suit the ideal requirements of its use case. The MemeChain concept is similar to that of a Sidechain, but the MemeChain in itself is not a protocol for transferring digital assets between peers and so will not be described as such. Rather, it should be described as a deterministic state-machine which derives its current state from information embedded in the Kekcoin blockchain. It consists of two components; a cryptographic hash-chain of memes that is embedded in the Kekcoin blockchain, and a distributed data store utilising the IPFS network.
The hash-chain is created using a special kind of blockchain transaction, one with an OP_RETURN script. This is a script which allows users to take advantage of the immutability and irreversibility of the blockchain. The script enables 80 arbitrary bytes of data to be embedded in the blockchain while rendering the transaction unspendable. In order to create a hash-link between MemeChain data in the blockchain, a specific data format will be defined. To illustrate an example of the formatting required, consider the following,
|--Identifier--|--Meme Hash--|--Hash(current meme hash+prev meme hash)--|
With 80 bytes in total, the first few bytes are used as an identifier for the MemeChain parsing module and the next string of bytes form the hash of this transaction's meme. The final string of bytes consists of the hash of the concatenated hashes of the current meme and the previous (confirmed) meme. This final string is what links the MemeChain transactions and thus constitutes the building block for the hash-chain.
Let's say that Kekcoin nodes who are simultaneously running the MemeChain software are called MemeChain nodes. How do MemeChain nodes establish a consensus about the state of the MemeChain? By ensuring that the methods for both injecting and extracting MemeChain data from the blockchain are deterministic, it is trivial to ensure that each MemeChain node is interacting with the same view of the state. This removes uncertainty that may arise in a non-deterministic set-up, and removes the need for MemeChain nodes to converse with each other about anything other than the state of the blockchain itself, which is a task that is completed through the Kekcoin core protocol already.
Due to the blockchain property of eventual consistency, whereby nodes only consider blocks of transactions to be confirmed once they are at a certain depth in the chain, the most recent blocks must be ignored by the MemeChain constructor. This is because, in theory (albeit with low probability), these latest blocks are subject to change through a brief fork as staking nodes concurrently hold a different view about the chain tip. By ignoring blocks which aren't at least at the required confirmation depth, a potential source of non-determinism is dealt with. For similar reasons a new MemeChain transaction must not be hash-linked with a previous MemeChain transaction which has not yet been confirmed.
It is important to note that the chain will form a directed acyclic graph (DAG) rather than a single sequence of memes.
IPFS is a new hypermedia storage and transfer protocol which will form part of the 'permanent web'. IPFS comprises a peer-to-peer network which reduntantly stores and shares data packets. The redundancy enables permanent hosting of content. Navigating the content hosted on IPFS is made trivial through the content-addressable method of storing the data in the distributed filesystem.
Utilising the resilient IPFS network we can enable persistent availability of memes. That is to say, once a meme has been added to the network it will remain there indefinitely. Moreover, IPFS enables high volumes of data to be distributed with high efficiency.
A MemeChain node will automatically run an IPFS node and thus contribute to the storage & sharing service of the network.
The MemeChain software will run as a daemon (a background process) and will handle the complexity of MemeChain transactions & IPFS content management. The interface that will connect the MemeChain daemon with any generic web application will be in the form of an API. A web application will be able to run their own MemeChain node, with local client HTTP API support, or it will be able to connect to a remote client which is exposing their API links publicly.
Any user or web app who runs the MemeChain software will at any given time share the exact same view of the state of the MemeChain and multiple applications will be able to update this state concurrently. An emphasis is being put on making the API extremely simple so that any developer can integrate the MemeChain into their software with ease.
MemeChain Web App
We are creating a canonical example of a web application which is fully integrated with the MemeChain software. This application will be an image board which browses and updates the MemeChain state.
To list some of the features that we have implemented so far:
An innovative feature of the MemeChain image board will be proof-of-authorship. Each user is given a public/private key pair which they can use to upload time-stamped, authored memes. Users will also be able to register multiple public keys with their accounts (provided they can prove ownership of the associated private keys).
You can find a preview screenshot below.
This documentation will be updated as development progresses and further design decisions are solidified. All suggestions and criticisms are welcome, just get in touch through our official Telegram chat group.