MIP-0003

From Mochimo Wiki
Revision as of 09:13, 22 November 2020 by Mochimowiki (talk | contribs) (Hard Fork Required)
Jump to: navigation, search

MIP-0003 - Add Fountain Functionality As Native Feature

Presented to the Core Contributor Team on November 21, 2020 by user sputnik

Sponsor(s)

The following Core Contributors have "sponsored" this MIP.

Stackoverflo (talk · contribs) I think it's long overdue. I'll code it as an optional module at first and if the community agrees we'll add it to the mainline code.



NOTE: Sponsorship for these purposes means that these Core Contributors have committed to developing the code on behalf of the community if this MIP is adopted. Note: Core Contributor sponsorship is not required for a MIP to be implemented. It just makes things easier on the community.

Problem Definition

Fountain services are presently operated by the Mochimo project, and while documentation exists for how to run a Fountain Service, it would be beneficial for this to simply be a built-in optional module for the full node code.

Solution Summary

Users will add a "fountain.addr" address file to the Mochimo Full Node startup directory, and then enable an additional command-line switch on node startup, to allow it to receive and process requests as a fountain node.

Hard Fork Required ?

No.

Technical Details

A global byte var "Fountain" is added to data.c to signal when the feature is enabled:

byte Fountain;        /* enable fountain service if true */


A new capability bit "C_FOUNTAIN" is added to types.h to signal the node has fountain service enabled:

#define C_FOUNTAIN   32

NOTE: At time of proposal CBIT 32 is the first available.

A command-line switch "r" is added to mochimo.c, and function usage() updated to reflect new switch "r":

void usage(void)
{
...
printf("usage: mochimo [-option...]\n"
"         -r         enable Fountain / Tag Registration Service\n"


Function main() switch(argv[j][1]) updated to reflect new switch "r", set global var Fountain to true, and set node capability bit for C_FOUNTAIN:

case 'r':  Fountain = 1;  Cbits |= C_FOUNTAIN;  break;


A new OP_CODE is added to types.h to identify when an inbound transaction is a Tag registration request to the fountain service.

#define OP_REGISTER       20


An handler entry is added to "execute.c" to call the registration function, when a registration request is received:

int execute(NODE *np)
{
...
  switch(np->opcode) {
  ...
     case OP_REGISTER:
        /* Process a tag registration request if Fountain service is enabled. */
        if(Fountain) register(np);
        return 0;

The file "fountain.c" is added to the source directory with the processing logic for the new OP_CODE.