Transaction Manager
The Sequence Transaction Manager leverages the Transaction API for dispatching transactions on Ethereum-compatible networks to service your game or app and scale to millions of users that brings an enormous amount of benefits such as:
- Gas abstraction -- whereby users can pay for network gas in a variety of tokens (ie. USDC, DAI, etc.)
- Sponsored gas -- projects may sponsor the gas of specific contracts to allow free gas for their users
- Batched transactions -- group a bunch of independent transactions and allow them to be mined as a single transaction
- Parallel transactions -- parallelize the dispatch of transactions in some cases
- Fire + forget model -- easily send transactions to the transactions api which will automatically manage nonces, bump gas, and other features which will ensure fast delivery
- Optimal gas pricing for transactions -- will be attempted once and if not included from the mempool within 3 blocks, the transaction will be resubmitted
A Sequence wallet is instantiated with a signer that can be any account such as an EOA. This wallet would then be utilized from your backend where you could could grant certain access control rights on your smart contracts such as minting tokens. Notably, this can be used for any blockchain transaction.
The only difference with respect to deployed EVM contracts: transactions with a Sequence Transaction Manager will have the msg.sender
as the Sequence Wallet address so it's important that proper permissions are granted to call the corresponding functions. In addition, tx.origin
will be one of the Relayer addresses, which can be seen in any one of the status pages: for example here on mainnet with the senders
array.
NFT Minter Quickstart
One of the most popular implementations is a minting service for creating and minting NFTs to your players from your backend, which massively reduces user friction. Below is a setup guide to run this code locally as a minter service with example contracts, which can be deployable to any infrastructure callable from your own application.
Clone the boilerplate and install:
npx sequence-cli boilerplates create-server-side-transactions
Fire a request to mint an NFT to a wallet:
curl -X POST http://localhost:3001/mint \
-H "Content-Type: application/json" \
-d '{"walletAddress": "0x0365e0BcAd6D799b732ADB9673cB4C43688Bb450"}'
Run on your own local server
To run your own transaction manager with your contract address and wallet, you can walk through the steps below to launches an express application, listening on port 3001
:
Sequence Builder Project Management
Create a project using this walkthrough.
See Chain Support for available networks.
Access Key Management
Obtain a Project Access Key using this walkthrough.
Generate Private Key for Transactions API
Generate an Ethereum private key as an Externally Owned Account (EOA) that is passed as a Single Signer to a Sequence Wallet to relay transactions. For demo purposes you can obtain a private key from here.
Deploy an ERC1155 Contract
Deploy a collectible contract by following this walkthrough.
This contract address can be replaced in the following code.
Set a Minter Role
on the Contract
Go to the Contracts page and select your deployed contract, then click the settings button to adjust permissions.
Once you have the modal open, select the Permissions
tab and you can Edit
, or, + Add Collaborator
.
Then input your created address to add as a collaborator and select the dropdown to assign the Minter
role.
Clone and run the boilerplate
Clone the boilerplate by running the below command from your terminal and input your EVM private key for the address above as well as your PROJECT_ACCESS_KEY
when prompted.
npx sequence-cli boilerplates create-server-side-transactions
Lastly, update the contractAddress
constant in the index.ts
file with your deployed contract address and run the repository via pnpm start
.
Perform Mint Transaction
Using a command line interface, call using cURL to mint to a wallet address:
curl -X POST http://localhost:3001/mint \
-H "Content-Type: application/json" \
-d '{"walletAddress": "0x0365e0BcAd6D799b732ADB9673cB4C43688Bb450"}'
Input an your desired wallet address you would like to mint to and fire the request!
You should receive a response with a txHash
:
{"txHash":"<TX_HASH>"}
You can view the source code of the boilerplate using the Transactions API by extending the codebase. For example: to incorporate batch transactions, offer ERC20 airdrops, and more.
Gas Sponsorship
On testnet, we sponsor all the transactions. However, on mainnet - you will want to ensure that you sponsor the transactions in order to ensure that they process correctly by sponsoring the contract itself. You can take a deeper look at our Gas Sponsorship solution to learn how to do this.