Introduction

Introduction

MetaKeep Lambda is supercharged runtime and API for your own smart contracts. It allows you to import and run any and all of your own smart contracts as first-class citizens on MetaKeep, receiving the same privileges our first-party contracts do(NFT and Coin contracts), in terms of the ability to scale (to ~65K peak TPS), resiliency (AI-powered transaction failure recovery, Probabilistic gas price management) and without gas fee (for you, your customers, and their users)- i.e., deferred billing.

👍

Gasless for you and your customers

When you use MetaKeep's Lambda infrastructure, neither you nor your customers have to worry about gas fees. We pick up the tab and bill your account at the end of month for all the gas consumed by your applications.

Testnets (ex: Polygon Amoy, Binance Testnet) are always free.

👍

Batch transactions

Bundle multiple transactions together to execute them as a single atomic unit.

👍

Built for scale

Mint at the speed of blockchain. Enterprises get unparalleled throughputs at the limit of blockchains, built by the same people who built infrastructure that casually clocks over 50M ops/sec at Meta, Twitter and Google.

👍

Incredible Resiliency

Balances; Nonces; Gas prices; Transaction lifecycle; Parallelization; 3rd party Outages; Retries; And a million other things.

We handle it all automatically with our AI powered Ops which works hand in hand with our team of on-call engineers and redundant infrastructure over Infura, Alchemy, and reserved nodes which ensures you get 99.999% reliability and resiliency that your customers expect of you.

👍

You own the deployed contracts

Only YOU own your deployed contracts and the derived assets, not us, as it should be, without any vendor lock-ins.

Lambda Business Wallets

Lambda 2 launched with the ability to perform gasless and resilient transactions at a smart contract level, by building around the Lambda Hardware Wallet core. Lambda 3 removes all friction point in Web3 at blockchain level by introducing the new Lambda Business Wallet core.

Lambda Business Wallets are a super-charged addition to the Classic EoA MetaKeep Hardware Wallets. They're issued on-chain, while being powered, backed, and secured by the same battle tested MetaKeep Hardware Wallet core.

Business Wallets are non-custodial, fully compliant, and owned exclusively by the users, no different from their Classic wallets. Your end-users can further use their embedded wallet built with Lambda Business wallet core on any platform they want to (e.g., Uniswap, or OpenSea), by using the same fully managed Wallet Connect bridge that they're used to, for their Classic wallets powered invisibly by MetaKeep.

Lambda Business Wallets are designed for extreme flexibility and best user and developer experience on the planet, without compromising on security. Business wallets + Lambda 3 give you the flexibility to call any deployed contract on any chain, send payments to any user or contract, issue batch transactions, make atomic transactions, and much more. And it's still gasless for you and your customers.

Here's a table comparing Lambda with Business Wallets and Lambda without Business Wallets.

FeatureWith Business WalletWithout Business Wallet
Gasless
Scale/Resiliency
No contract modifications
Atomic Batch transactions
Import already deployed contracts
Import and interact frictionlessly with popular contracts e.g. UniSwap, Aave
Payment(value transfer)

Getting Started with Lambda Business Wallets

Business wallets are used automatically when you send BUSINESS_WALLET in the using parameter of Lambda invocation(s). If you don't specify the using parameter, the lambda invocation will not use Business Wallet.

{
  "using": "BUSINESS_WALLET"
}

To get the business wallet for a user, you can use the Get Lambda Business Wallet API. If you don't specify the user parameter, the API will return the business wallet for your developer app.

Creating Lambda

The process of creating a new Lambda depends on whether you plan to use business wallets or not. If you don't plan to use business wallets, you need to make minor modifications to your contract.

Create Lambda with Business Wallets

To create a new Lambda with business wallets, you don't need to make any changes to your contract. We recommend adding access control to your contract where the owner is your developer app business wallet. This will allow you to make lambda calls from your developer app business wallet. Make sure to send the contract owner's address explicitly in the constructor of your contract. Do not use msg.sender since it will be one of MetaKeep's gas accounts when creating the lambda.

You can find a detailed guide and working end-to-end demo for MetaKeep Lambda with Business Wallets here.

Create Lambda without Business Wallets

The process of creating a Lambda without business wallets is like this:

  1. Import MetaKeep Lambda middleware contracts
npm install metakeep-lambda
  1. Initialize MetaKeep Lambda in your constructor.
  2. Create a new Lambda using New Lambda.
  3. Execute any Lambda(smart contract) function using Invoke Lambda.

You can find a detailed guide and working end-to-end demo for MetaKeep Lambda here.

The lambda constructor expects 2 required arguments:

  • lambdaName : This should be a non-empty name for your Lambda.
  • lambdaOwner : This is Lambda owner eth address. This should match your developer account eth address.

Importing Lambda

You can import already deployed contracts that will be managed by MetaKeep Lambda Infrastructure using Import Lambda API. This can be used to import contracts that you have already deployed or to import popular contracts like Uniswap, Aave, USDC, etc.

Note that imported contracts can only be used with business wallets.

Solidity types to Lambda types

MetaKeep Lambda provides HTTP APIs to invoke your smart contract and read data from the read-only(pure or view) function. You can invoke the APIs by sending a JSON request that looks like this:

// Invoke smart contract: mint(address to, uint256 tokenId)
{
   "function":{
      "name":"mint",
      "args":[
         // Mint to address
         "0x6B40cA2814198A37BA5798B0C5EE1A2E029b997f",
         // Token Id
         "10"
      ]
   }
}

Since JSON doesn't support all Solidity types (uint256, bytes, etc.), Lambda supports types in the format supported by JSON.

The table below describes how to map the Solidity type to the JSON type:

Solidity typeJSON typeExample
BooleanBoolean
int, uint
int8,…,int256
uint8,…,uint256
StringHere are some examples:
123 maps to "123"
-123 maps to "-123"
addressStringHex-encoded address string e.g.
0x6B40cA2814198A37BA5798B0C5EE1A2E029b997f maps to "0x6B40cA2814198A37BA5798B0C5EE1A2E029b997f"
bytesStringHex-encoded bytes string e.g.
0x1234 maps to "0x1234"
bytes1,…,bytes32StringMust be passed as 0-padded hex strings to match the length of the bytes e.g. 0x0034 for bytes2 and 0x00000034 for bytes4 etc.
ArrayArraye.g. [1, "2", 0x1234] maps to ["1", "2", "0x1234"]
structDictionarye.g. struct Person { string name; uint age; } can be sent as a JSON Dictionary like this:
{ "name": "John", "age": "20" }

Note that Dictionary field values should also be mapped to their respective JSON types.

Data returned by Read Lambda API also maps the Solidity type to the JSON type as described in the table above.

© Copyright 2024, Passbird Research Inc.