How to integrate Paymaster on Abstract Chain with a simple API call?
Summary
TLDRThis demo showcases integrating Sci-fi's API with a Dapp, highlighting its native account abstraction for gas usage. The focus is on enabling transactions paid in any token, exemplified by a mock ERC20 token on a testnet. The process includes connecting a wallet, using the API to execute transactions like token transfers without gas fees, and signing payloads with a wallet. The integration is simplified with tools like Rainbow Kit and Wagi, demonstrating a seamless user experience with Etherscan verification.
Takeaways
- π The video is a demo on integrating Sci-Fi's API with a Dapp for gas abstraction.
- π³ Sci-Fi is a pay-as-a-service product that abstracts gas usage in blockchain interactions.
- π‘ Gas sponsoring is a popular use case, allowing users to perform operations like submitting NFDs or executing swaps without gas fees.
- π The demo focuses on enabling users to pay for transactions using any token, exemplified with a mock ERC20 token on a testnet.
- π¨ The presenter showcases a web design with a connected wallet balance for the mock token.
- π°οΈ Interaction with the smart contract is done indirectly by sending a request to Sci-Fi's API, specifying the function, parameters, and payment token.
- π The API responds with a payload that the user signs with their wallet, executing the transaction without token approvals.
- π The demo includes transferring tokens between wallets, demonstrating the process on Etherscan and showing a small amount of tokens used to pay for the transaction.
- π οΈ Integration of Sci-Fi's API into code is shown using Rainbow Kit and Wagi for blockchain interaction on the custom Abstract testnet.
- π The script outlines steps for encoding functional data, preparing API requests, fetching responses, and creating a wallet client for transaction preparation.
- π The final step is sending a transaction with the wallet client's signature and waiting for the receipt, completing the integration process.
Q & A
What is the main purpose of the demo presented in the script?
-The main purpose of the demo is to show how to integrate sci-fi's API with a database to abstract gas usage when interacting with the blockchain, focusing on enabling users to pay for transactions using any token.
What is sci-fi's API and how does it relate to Master as a Service (DBaaS)?
-Sci-fi's API is a service that allows for abstracting gas usage when interacting with the blockchain. It is related to DBaaS in the context of the demo as it provides a way to handle gas costs and token transactions without direct interaction with smart contracts.
What are the two popular use cases of sci-fi's API mentioned in the script?
-The two popular use cases mentioned are gas sponsoring, which allows a DB to cover its user's gas cost, and enabling users to pay for transactions using any token.
Why is gas sponsoring a useful feature for users?
-Gas sponsoring is useful because it allows users to perform operations such as submitting NFTs or executing swaps on a DEX without having to pay for the gas costs themselves.
What is the role of the mock ERC20 token in the demo?
-The mock ERC20 token serves two purposes in the demo: it is used to pay for gas and also as the token for performing transfer transactions.
How does the API handle the process of transferring tokens without gas?
-The API handles the process by sending a request specifying the function to call, its parameters, and the token for payment. It then responds with a payload that the user signs with their wallet, and the transaction is executed automatically.
What does the term 'abstract test net' refer to in the context of the demo?
-The 'abstract test net' refers to a test network environment where the demo is deployed, allowing for the testing of the sci-fi API and its functionalities without using real assets.
How is the transaction executed after the user signs the payload from the API?
-After the user signs the payload, the transaction is automatically executed by the system, without the need for token approvals, and the user's wallet is debited a small amount to pay for the transaction.
What is Etherscan and why is it mentioned in the demo?
-Etherscan is a blockchain explorer that allows users to view transaction details on the Ethereum blockchain. It is mentioned in the demo to show the transaction details after the transfer of tokens.
How does the integration of sci-fi's API into the code work in the demo?
-The integration involves setting up with Web3.js and using a custom chain (abstract test net), encoding the functional data for the transfer, preparing the API request payload, fetching the response, creating a wallet client, finding the user's latest nonce, and preparing the transaction data for the paymaster.
What is the final step in the integration process after preparing the transaction data?
-The final step is to send the transaction, which triggers the signature from the wallet client, and then wait for the transaction receipt to confirm the transaction's completion.
Outlines
π Introduction to Sci-fi API Integration
The speaker introduces a demonstration on integrating Sci-fi's API, a payment abstraction service that simplifies blockchain interactions by allowing gas usage to be abstracted. The focus is on two main use cases: gas sponsoring, where a platform can cover user gas costs for operations like submitting NFTs or executing swaps, and enabling transactions using any token. The demo utilizes the Abstract testnet and a mock ERC20 token for both gas payment and transfer transactions, showcasing a seamless user experience without direct smart contract interactions.
π» Setting Up the Demo Environment
The speaker details the setup for the demo, which includes a beautiful web design with a connected wallet balance display for the mock token. The process involves sending requests to Sci-fi's API to specify the desired smart contract function, parameters, and payment token. The API then returns a payload for the user to sign with their wallet, executing the transaction automatically without the need for token approvals. The demo also includes a transfer of tokens between wallets, illustrating the transaction details on Etherscan.
π Demonstrating Token Transfer without Gas Guess
In this part of the demo, the speaker performs a token transfer between two wallets without any gas fees paid by the user. The transaction is executed by the payMaster, with a small amount of tokens deducted from the user's wallet to cover the transaction costs. The speaker emphasizes the ease of integrating Sci-fi's API into code, using Rainbow Kit and Wagi with custom chain setup for the Abstract testnet.
π οΈ Integrating Sci-fi API into Code
The speaker outlines the steps to integrate Sci-fi's API into code, starting with encoding the functional data for a transfer, preparing the API request payload with chain ID, fee token, and transaction data. The process continues with fetching the API response, creating a wallet client configured for EIP 712 actions, finding the user's latest nonce, and preparing transaction data for the payMaster using the API response. The final step is to send a transaction that triggers the signature from the wallet client and waits for the receipt, completing the integration process.
Mindmap
Keywords
π‘API
π‘Gas Usage
π‘Native Account Abstraction
π‘Gas Sponsoring
π‘Smart Contract
π‘ERC20 Token
π‘Test Net
π‘EIP 712
π‘Wallet Client
π‘Transaction Data
π‘Paymaster
Highlights
Introduction to a demo on integrating sci-fi's API with a database.
sci-fi is a pay-as-a-service product for abstracting gas usage in blockchain interactions.
Gas sponsoring allows a DB to cover user gas costs for smart contract operations.
Demonstration of enabling users to pay for transactions using any token.
Use of the abstract test net and deployment of a mock ERC20 token for demo purposes.
The mock token serves the dual purpose of paying for gas and performing transfer transactions.
Overview of the web design used in the demo and its features.
Explanation of how to interact with the smart contract via sci-fi's API instead of directly.
Process of sending a request to sci-fi's API specifying the desired function and payment token.
The API's response includes a payload for the user to sign with their wallet.
Automatic execution of the transaction after signing without token approvals.
Transfer of tokens between wallets without gas fees demonstrated.
Etherscan verification of transaction details and gas payment by pay-Master.
Integration of sci-fi's API into code using Rainbow Kit and Wagi NVM.
Setup of the custom chain, abstract test net, with WME for blockchain interaction.
Simple steps to integrate sci-fi API calls in the codebase.
Encoding of functional data for the transfer in the API request payload.
Fetching the API response and creating a wallet client with EIP 712 actions.
Preparation of transaction data for pay-Master using the API response.
Final step of sending the transaction with wallet client signature and waiting for the receipt.
Transcripts
hey everyone today I'm going to show you
a quick demo on how to integrate
sci-fi's API with your daab zfi is a pay
Master as a service product that allows
you to abstract gas usage when
interacting with the blockchain using
native account
abstraction one of our most popular use
cases is gas sponsoring which lets a DB
cover its user gas cost when when
performing operations against its smart
contract for example this could allow
users submit nfds or execute swaps on a
particular dep for free another use case
which is the focus of this demo is
enabling users to pay for a transaction
using any token for this example I'll be
using the abstract test net since it's a
test net I've deployed a mock erc20
token that will serve us two purposes it
will be the token used to pay for gas
and also the one we use to perform
transfer
transactions first let's admire this
beautiful web design that I put together
at the bottom you can see the current
balance of the connected wallet for a
mop
token notice that none of the wallets
that I'm using in this demo have any
e instead of interacting directly with
the smart contract I'll send a request
to zi's API specifying which function I
want to call it's parameters and the
token I want to use for payment the API
will work its magic and respond with the
payload that the user will sign with
their wallet once signed the transaction
is automatically executed without the
need for token
approvals next I'm going to transfer a
few tokens between those two wallets
without any guess and we'll see what it
looks like on ether scan
notice that a small amount of tokens
came out of the user's wallet to the pay
Master to pay for the transaction while
the transaction itself was paid by the
pay
Master now I'm going to show you how
easy it is to integrate sci-fi's API
into your
code for our demo I'm using rainbow kit
wagi NVM for interacting with the
blockchain because we're using a custom
chain which is abstract test net this is
how I set it up with
WME finally let's see how simple it is
to integrate sci-fi API
calls remember this is the mock token
address that we're going to be using
both for fees and for the transfers this
is the function that gets called when
the user clicks the button on our front
end step number one you encode the
functional data for the
transfer step two you prepare the API
request payload specifying the chain ID
the token that are is going to be used
for fees and the transaction
data step three you fetch the response
from the
API step four you create a wallet client
based on our configuration and extended
with the EIP 712
actions step step five you find the
users's latest Nots and step six you
prepare the transaction data for the pay
Master using the response from the
API all you need to do now is send a
transaction which is going to fire um
the signature from your wallet clients
and wait for the
receipt you're done
Browse More Related Video
How To Analyze Any Crypto Token in 5 Minutes (Dune Analytics)
Getting Started with Plaid in 3 Minutes
WhatsApp Cloud API - Automatizza WhatsApp e integra con altri Tool!
Wallet in Telegram: What it is and how it works β‘οΈ Hamster Academy
$10,000/Month Autopilot AI Side Hustle Pays Free Money & Free Crypto - Make Money Online (Cryptomus)
How To Stake WMT | World Mobile Vault Guide - Passive Crypto Income
5.0 / 5 (0 votes)