Docs

Get Started

Learn the basics on using Engine.

Manage Engine from the dashboard

Navigate to the thirdweb Engine dashboard to manage your Engine instances.

Overview

  • View your backend wallets.
  • Create a backend wallet.
  • View recent transactions.
  • View transaction details (e.g. error messages, gas used).
  • Cancel a queued transaction.

Explorer

  • Interactively view and call your Engine API.

Relayer

  • View relayers.
  • Add or remove relayers.

Configuration

  • Change backend wallet types.
  • View webhooks.
  • Add and remove webhooks.

Permissions

  • View admin users.
  • Add and remove admin users.
  • View access tokens.
  • Create and revoke access tokens.

Manage permissions

Engine endpoints require authentication.

  • Add other admins for other users to manage Engine from the dashboard.
  • Create access tokens for your backends to call the Engine API. These are secrets that should be stored securely.
  • Revoke permissions at any time.

Learn more about permissions.

Create backend wallets

Backend wallet are your wallets managed by Engine. Engine will send blockchain transactions from these wallets.

  • Configure how to back up wallets.
  • Create or import a backend wallet.
  • Specify the backend wallet to use when calling the Engine API.

Learn more about backend wallets.

Interact with the blockchain

Here are a few example API calls.

Get a wallet's balance

const resp = await fetch(
  "<engine_url>/backend-wallet/<chain>/<backend_wallet_address>/get-balance",
  {
    headers: {
      Authorization: "Bearer <access_token>",
    },
  },
);

const { result } = await resp.json();
console.log("Balance:", result.value);

Read from a contract

This code example does not require gas funds and returns the function result.

const resp = await fetch(
  "<engine_url>/contract/<chain>/<contract_address>/read?functionName=balanceOf&args=0x3EcDBF3B911d0e9052b64850693888b008e18373",
  {
    headers: {
      Authorization: "Bearer <access_token>",
    },
  },
);

const { result } = await resp.json();
console.log("ERC-20 balance:", result);

Write to a contract

This code example calls a write method on a contract. It requires gas funds and returns a queueId to query for the result.

const resp = await fetch(
  "<engine_url>/contract/<chain>/<contract_address>/write",
  {
    method: "POST",
    headers: {
      "Content-Type": "application/json",
      Authorization: "Bearer <access_token>",
      "x-backend-wallet-address": "<backend_wallet_address>",
    },
    body: JSON.stringify({
      functionName: "transferFrom",
      args: [
        "0x1946267d81Fb8aDeeEa28e6B98bcD446c8248473",
        "0x3EcDBF3B911d0e9052b64850693888b008e18373",
        "0",
      ],
    }),
  },
);

const { result } = await resp.json();
// queueId is a reference to the transaction queued by Engine.
console.log("Queue ID:", result.queueId);

Deploy a contract

This code example deploys a thirdweb NFT drop contract. It requires gas funds and returns a queueId to query for the result.

const resp = await fetch("<engine_url>/deploy/<chain>/prebuilts/nft-drop", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    Authorization: "Bearer <access_token>",
    "x-backend-wallet-address": "<backend_wallet_address>",
  },
  body: JSON.stringify({
    contractMetadata: {
      name: "thirdweb Engine example",
      symbol: "eng",
      primary_sale_recipient: "0x3EcDBF3B911d0e9052b64850693888b008e18373",
    },
  }),
});

const { result } = await resp.json();
// queueId is a reference to the transaction queued by Engine.
console.log("Queue ID:", result.queueId);

Engine can enable your application to airdrop NFTs, send funds between wallets, update on-chain game state, and more.

Check the status of a transaction

const resp = await fetch("<engine_url>/transaction/status/<queue_id>", {
  method: "GET",
  headers: {
    Authorization: "Bearer <access_token>",
  },
});

const { result } = await resp.json();
// status can be: processed, queued, sent, errored, mined, cancelled, retried
const isComplete = ["mined", "errored", "cancelled"].includes(result.status);

Configure webhooks

Get notified when a transaction is mined, in addition to other wallet and transaction events.

  • Navigate to the Webhooks tab on the Engine dashboard.
  • Create a new webhook URL.

Learn more about webhooks.