Skip to main content

Getting Started with MOUNTAIN Events

Basic Workflow​

  1. Create Subscription: Set up monitoring for specific contract events
  2. Implement Webhook: Build a server to receive event notifications
  3. Process Events: Handle incoming blockchain events in your application

Creating Your First Subscription​

API Endpoint:

Basic Example:

import { EventNotifierApi } from '@kyuzan/mountain-public-api-client';

const eventApi = new EventNotifierApi();

const subscription = await eventApi.createEventNotifierSubscription({
subscriptionName: 'Transfer Events',
networkId: 1, // Ethereum Mainnet
address: '0x1234567890123456789012345678901234567890',
formattedAbiEvent: 'event Transfer(address indexed from, address indexed to, uint256 value)',
initialBlockNumber: 1000000,
scanInterval: 10,
webhookURL: 'https://your-app.com/webhook',
webhookMaxRetries: 3,
});

console.log('Subscription created:', subscription.eventNotifierSubscription);

Enabling Webhook Notifications​

After creating a subscription, you may need to update webhook settings to enable notifications.

API Endpoint:

Example:

// Enable webhook notifications
const updatedSubscription = await eventApi.updateEventNotifierSubscriptionWebhook({
id: subscription.eventNotifierSubscription.id,
webhookEnabled: true,
webhookURL: 'https://your-app.com/webhook',
webhookMaxRetries: 5,
});

console.log('Webhook enabled:', updatedSubscription.eventNotifierSubscription);

Next Steps​

  1. Implement webhook receiver - Most important step
  2. Understand event data format - Learn about received data structure
  3. Manage subscriptions - Update and monitor your subscriptions