Quickstart guide
0 to 1 as fast as possible
The recommended path to developing an application with MEM is:
Write a MEM function in JavaScript, leaning on examples and the syntax spec for guidance
Test in the IDE or locally
Integrate MEM with your UI using API calls
Get your function whitelisted for mainnet
Writing MEM functions
The fastest and best-documented way to write MEM functions is in JavaScript. The IDE and examples repo has plenty you can test and fork for common backend patterns.
Here's the function.js for a counter:
Here's its respective state.json, which holds global variables and the ABI:
Name service (code)
Testing in the IDE
The MEM IDE is a web playground for you to write and test functions without needing to deploy them live.
Use the +
button for a new blank slate or to choose one of the examples.
Each function consists of a function.js
and a state.json
-- the state holds global variables and the function ABI, which populates the interaction panel below the function code editor.
The IDE is powered by the mem-testnet package, which you can also run locally.
Optional: adding authentication methods
By default, functions in MEM are fully public and anonymous.
Developers can add web3 authentication via in-function calls to authentication molecules. These molecules accept a wallet address and a signature and return true/false based on whether the signature can be verifiably attributed to the caller.
Click here for an example of EVM authentication.
Deploying with the CLI
When you're happy with how the function runs in the IDE, you can use the CLI to deploy it to the MEM Carbon testnet.
Install the CLI:
Deploy a function:
Copy the function ID from the CLI once deployed.
Mainnet functions must be whitelisted before they will accept interactions. This is a temporary safeguard while MEM is in beta. Use this form to submit a whitelist request. We recommend developers use the MEM Carbon Testnet by passing the --testnet
flag to the CLI.
Integrating MEM with your front end
MEM functions can be read and written to from a front end using the MEM API.
Get extra help
Reach out to us on Telegram and Discord, or book a call to discuss.
Last updated