Skip to content

0xsequence-demos/server-side-transactions-boilerplate

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

63 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Server Side Transactions Boilerplate

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).

Prerequisites

  • 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/

Quickstart with Sequence CLI

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"}'

How to run locally with source

  1. Update Server Configuration: Copy .env.example to .env with cp .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 here
  • PROJECT_ACCESS_KEY: Use this walkthrough to obtain an access key
  1. Deploy Collectible: Deploy an ERC721 contract with this walkthrough, and the obtained contract collectible contract address to be used in step 4.
  2. 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.
  3. Set Minter Role: Go to the Contracts 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.
  4. Install Packages: Run in the project's root directory: $ pnpm install
  5. Run tx-manager: Also in the project's root directory run: $ pnpm start
  6. Mint Token: Use a command line interface to call using cURL to mint to a wallet address (could change the walletAddress to your own):

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published