Skip to content

Commit 6d7d1f1

Browse files
authored
Update copytrading bot app to use Streams (#180)
1 parent eb1b54a commit 6d7d1f1

File tree

4 files changed

+28
-26
lines changed

4 files changed

+28
-26
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ ln -s ../../scripts/pre-commit-tree.sh .git/hooks/pre-commit
201201
- [Tron gRPC Project Setup Guide](./tron/tron-grpc)
202202

203203
### Webhooks
204-
- [BNB Chain Copytrading Bot with Quicknode Webhooks](./webhooks/copytrading-bot-bnb) - *A copytrading bot for memecoins launched on four.meme platform on BNB Chain using Quicknode Webhooks.*
204+
- [BNB Chain Copytrading Bot with Quicknode Streams](./webhooks/copytrading-bot-bnb) - *A copytrading bot for memecoins launched on four.meme platform on BNB Chain using Quicknode Streams.*
205205

206206
<!-- PROJECT-DIRECTORY:END -->
207207

webhooks/copytrading-bot-bnb/.env.example

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ BNB_RPC_URL=your-quicknode-rpc-url # 👈 UPDATE HERE
44
# Wallet Configuration (⚠️ KEEP THIS SECURE)
55
PRIVATE_KEY=your-private-key # 👈 UPDATE HERE
66

7-
# Webhook Security
7+
# Streams Security
88
QUICKNODE_SECURITY_TOKEN=your-security-token # 👈 UPDATE HERE
99

1010
# Server Configuration

webhooks/copytrading-bot-bnb/README.md

Lines changed: 25 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
# BNB Chain Copytrading Bot with Quicknode Webhooks
1+
# BNB Chain Copytrading Bot with Quicknode Streams
22

3-
An automated copytrading bot that monitors successful traders on the four.meme platform (BNB Chain's memecoin launchpad) and executes proportional trades in real-time using Quicknode Webhooks.
3+
An automated copytrading bot that monitors successful traders on the four.meme platform (BNB Chain's memecoin launchpad) and executes proportional trades in real-time using Quicknode Streams.
44

55
## Overview
66

77
This bot demonstrates how to build a copytrading system by:
88

99
- Monitoring specific wallet addresses for token purchases on BNB Chain
10-
- Receiving instant notifications via Quicknode Webhooks
10+
- Receiving instant notifications via Quicknode Streams
1111
- Automatically executing proportional copy trades with configurable parameters
1212
- Implementing safety features like slippage protection and balance reserves
1313

14-
> Read the complete guide: [Building a Copytrading Bot on BNB Chain with Quicknode Webhooks](https://www.quicknode.com/guides/quicknode-products/webhooks/copytrading-bot-with-webhooks)
14+
> Read the complete guide: [Building a Copytrading Bot on BNB Chain with Quicknode Streams](https://www.quicknode.com/guides/quicknode-products/streams/copytrading-bot)
1515
1616
## Features
1717

@@ -46,17 +46,19 @@ npm --version
4646
- Select **"BNB Smart Chain"****"Mainnet"**
4747
- Choose your desired plan
4848
- Click **"Create Endpoint"**
49-
- Copy your **HTTP Provider URL** (e.g., `https://example.bnb.quiknode.pro/abc123/`)
49+
- Copy your **HTTP Provider URL** (e.g., `https://example.bsc.quiknode.pro/abc123/`)
5050

51-
3. **Set Up Webhook**
52-
- Navigate to [Webhooks Dashboard](https://dashboard.quicknode.com/webhooks)
53-
- Click **"Create Webhook"**
51+
3. **Set Up Stream**
52+
- Navigate to [Streams Dashboard](https://dashboard.quicknode.com/streams)
53+
- Click **"New Stream"**
5454
- Select **"BNB Smart Chain"****"Mainnet"**
55-
- Choose **"Write a custom filter"**
55+
- Select **Block with Receipts** as the dataset
56+
- Click **Customize your payload** to apply a filter and choose the **Write your own filter** option
5657
- Copy the filter code from `filter.js` in this repository
5758
- Update `TARGET_WALLET` in the filter to the address you want to monitor (e.g., `0x4262F7B70b81538258EB2C5ECAD3947Ba4e0C8b0`)
5859
- Test the filter with a block number you want to monitor (e.g., `65392331`)
59-
- Save the **Security Token** shown in the webhook settings
60+
- Select **Webhook** as the destination type
61+
- Save the **Security Token** shown in the settings
6062

6163
**Note:** Setting destination URL will be done after setting up your public URL in step 4. So, leave it here for now. We will come back to it later.
6264

@@ -98,7 +100,7 @@ Edit `.env` with your values:
98100

99101
```bash
100102
# Quicknode Configuration
101-
QUICKNODE_SECURITY_TOKEN=your_security_token_from_webhook_dashboard # 👈 UPDATE HERE
103+
QUICKNODE_SECURITY_TOKEN=your_security_token_from_streams_dashboard # 👈 UPDATE HERE
102104
BNB_RPC_URL=https://your-quicknode-bnb-endpoint.quiknode.pro/abc123/ # 👈 UPDATE HERE
103105

104106
# Wallet Configuration (⚠️ KEEP THIS SECURE)
@@ -161,13 +163,13 @@ Copy the **HTTPS URL** from ngrok output:
161163
Forwarding https://abc123.ngrok.io -> http://localhost:3000
162164
```
163165

164-
### 3. Create Your Quicknode Webhook
166+
### 3. Create Your Quicknode Stream
165167

166-
Go back to your [Quicknode Webhook Dashboard](https://dashboard.quicknode.com/webhooks):
168+
Go back to your [Quicknode Streams Dashboard](https://dashboard.quicknode.com/streams):
167169
1. Fill in the **Destination URL** field with your ngrok URL + `/webhook`
168-
2. Test the webhook by sending a test payload
170+
2. Test the webhook destination by sending a test payload
169171
3. If bot is running, you should see that bot acts accordingly since it receives the webhook
170-
4. Save the webhook
172+
4. Save the Stream
171173

172174
### 4. Monitor Bot Activity
173175

@@ -210,7 +212,7 @@ copytrading-bot/
210212
│ ├── webhookServer.ts # Express server for receiving webhooks
211213
│ ├── tradingBot.ts # Viem-based trading logic
212214
│ └── index.ts # Entry point
213-
├── filter.js # Quicknode webhook filter (for reference)
215+
├── filter.js # Quicknode Stream filter (for reference)
214216
├── .env # Your environment variables (DO NOT COMMIT)
215217
├── .env.example # Template for environment variables
216218
├── package.json # Node.js project file
@@ -227,12 +229,12 @@ copytrading-bot/
227229
ngrok http 3000
228230
```
229231

230-
**Verify Quicknode webhook URL**:
232+
**Verify Quicknode Streams Destination URL**:
231233
- Should be: `https://your-ngrok-url.ngrok.io/webhook` (note the `/webhook` path)
232234

233-
**Check Webhook status**:
234-
- Visit [Quicknode Webhooks Dashboard](https://dashboard.quicknode.com/webhooks)
235-
- Ensure webhook is **Active** and has recent deliveries
235+
**Check Streams status**:
236+
- Visit [Quicknode Streams Dashboard](https://dashboard.quicknode.com/streams)
237+
- Ensure Streams is **Active** and has recent deliveries
236238

237239
### "Insufficient balance" errors
238240

@@ -278,8 +280,8 @@ QUICKNODE_SECURITY_TOKEN=your_token_here
278280
```
279281

280282
**Get correct token**:
281-
1. Go to Quicknode Webhooks Dashboard
282-
2. Click on your webhook
283+
1. Go to Quicknode Streams Dashboard
284+
2. Click on your Stream
283285
3. Copy the "Security Token" shown
284286
4. Update your `.env` file
285287
5. Restart the bot
@@ -298,7 +300,7 @@ QUICKNODE_SECURITY_TOKEN=your_token_here
298300
## Resources
299301

300302
- **[Quicknode Documentation](https://www.quicknode.com/docs)**
301-
- **[Quicknode Webhooks Guide](https://www.quicknode.com/docs/webhooks)**
303+
- **[Quicknode Streams Documentation](https://www.quicknode.com/docs/streams)**
302304
- **[Viem Documentation](https://viem.sh/)**
303305
- **[BNB Chain Docs](https://docs.bnbchain.org/)**
304306
- **[four.meme Platform](https://four.meme/)**

webhooks/copytrading-bot-bnb/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "copytrading-bnb",
33
"version": "1.0.0",
4-
"description": "A copytrading bot for memecoins launched on four.meme platform on BNB Chain using Quicknode Webhooks.",
4+
"description": "A copytrading bot for memecoins launched on four.meme platform on BNB Chain using Quicknode Streams.",
55
"main": "src/index.ts",
66
"scripts": {
77
"dev": "tsx src/index.ts",

0 commit comments

Comments
 (0)