DEV Community

Cover image for How to interact with "MOMP" smart contract
Jeevanjot Singh
Jeevanjot Singh

Posted on

How to interact with "MOMP" smart contract

Greetings everyone,

Brief about "MOMP Network"

"MOMP" (Money Over Mail Protocol) provides a mechanism for sending money to email addresses on top of decentralized network. MOMP itself is a set of rules (Protocol) originally created by "Jeevanjot Singh" and currently implemented by momp.network. Learn more about "MOMP" from the document

Process to interact with "MOMP" smart contract

You need a supported web wallet to perform any operation for "MOMP", Currently supported wallet is Superhero and you can add it on your browser from extension marketplace, For e.g. Chrome browser wallet extension

There are some useful methods that might doesn't exist in a front-end currently. You can directly use the "MOMP" smart contract to interact with those methods.

First Steps:

  • For ease, Use an online editor to load the MOMP smart contract e.g. Ae studio. Visit https://studio.aepps.com/ and change your settings from Testnet to Mainnet. Select option Browser Wallet and make sure that your wallet's network is Mainnet. Look for permissions and if agree then click accept.
    momp smart contract

  • Now, Copy the smart contract code of "MOMP" from github link and add it in a new file inside the editor.
    momp smart contract

  • Now, You need to call the existing contract instead of deploying new one. The existing MOMP contract is deployed on mainnet address at ct_2uJthb5s1D8c8F8ZYMAZ6LYGWno5ubFnrmkkHLE1FBzN3JruQw. So fill this contract address the input field next to use at address and click that use at address
    momp smart contract

  • Now, You can see your contract under Deployed Contract section. Expand the contract to see its methods.
    momp smart contract

Calling methods

There are numerous methods that are useful for an individual to learn more about MOMP. But lets focus on some that currently you can use easily. Call Locally methods are read only methods that won't require any transaction fee and can be called with appropriate parameters ([]) to get the status of a state variable or any other information returnable.

  • get_base_fee (get base fee) :- It gets you the current base fee (Transaction fee - SMTP base fee) of MOMP smart contract.

  • get_registration_fee (get registration fee) :- It gets you current registration fee that is required to register & verify your email on top of smart contract.

  • get_time_for_refund_in (get time for refund in) :- It gets you current millisecond value that is being added to each payment to mark its expiry (transaction block time + returned value)

  • clients_balance (clients balance) [Email {hashed using Sha256}] :- Using unregistered (unverified) email (hashed with sha256 in bytes32 format), you can fetch your current balance in the smart contract.

  • clients_pub_key (clients pub key) [Email {hashed using Sha256}] :- Using the email (hashed with sha256 in bytes32 format), You can find public key of the email.

  • get_time_for_refund_in_for_payment_id (get time for refund in for payment id) [Payment id, Address of sender] :- It gets you current millisecond value (UNIX Timestamp) that show when a payment will expire (Can be claimed from both side now [Sender & Receiver])
    momp smart contract

  • claim refund (claim refund) [Payment Id] :- Using payment ID, Sender can claim their amount back if it is expired.

  • getNextQueryID :- It fetches the upcoming payment ID or query ID from Say Network's SMTP module for visual use.
    momp smart contract

Note:

  • In this process neither sender nor receiver will ever need to expose their email on the public blockchain network.

Learn more about this protocol from this document (AKA white paper)

Links

Top comments (0)