A simple nodejs backend that relays transactions via the Sequence Transactions API from a restricted origin frontend. Server can be generalized for any type of transaction beyond just collectible minting (e.g. distributing ERC20 tokens to wallets).
- git installed
- node version v22.6.0 installed and in use
- Project cloned with
git clone https://github.com/0xsequence-demos/server-side-transactions-boilerplate/
To quickly start using the Sequence CLI you can use the following command locally on your machine or on a server using the default environment variables for EVM_PRIVATE_KEY
& PROJECT_ACCESS_KEY
:
npx sequence-cli boilerplates create-server-side-transactions
Then mint an ERC721 collectible to your wallet by swapping out the walletAddress
with your address in the following command:
curl -X POST http://localhost:3001/mint \
-H "Content-Type: application/json" \
-d '{"walletAddress": "0x0365e0BcAd6D799b732ADB9673cB4C43688Bb450"}'
Update Server Configuration
: Copy.env.example
to.env
withcp .env.example .env
and complete fields
EVM_PRIVATE_KEY
: Generate Ethereum private key as an Externally Owned Account (EOA) passed into a Sequence Wallet as a signer. For demo purposes you can obtain a private key from herePROJECT_ACCESS_KEY
: Use this walkthrough to obtain an access key
Deploy Collectible
: Deploy an ERC721 contract with this walkthrough, and the obtained contract collectible contract address to be used in step 4.Get Sequence Wallet Address
: This can be obtained by going the Transactions API page and pasting in your EOA Private Key generated in Step 1, elicited as the Wallet Address.Set Minter Role
: Go to theContracts
section in Sequence Builder and navigate to Settings > Permissions > Add Collaborator. Add the public address of your generated Sequence Wallet and give the Minter role permissions from step 4.Install Packages
: Run in the project's root directory:$ pnpm install
Run tx-manager
: Also in the project's root directory run:$ pnpm start
Mint Token
: Use a command line interface to call using cURL to mint to a wallet address (could change thewalletAddress
to your own):