AI prompts
base on Solana Swiss Army Knife <p align="center">
<img src="listen-landing/public/listen-more.png" width="35%" />
<br />
</p>
<p align="center">
<a href="https://docs.listen-rs.com/"><img src="https://img.shields.io/badge/docs-API-blue.svg" /></a>
<a href="https://github.com/piotrostr/listen"><img src="https://img.shields.io/github/stars/piotrostr/listen?style=social" /></a>
<a href=""><img src="https://img.shields.io/badge/built_with-Rust-dca282.svg?logo=rust" /></a>
</p>
<p align="center">
<code>listen</code> started sa Solana Swiss-Knife toolkit for algorithmic trading, its mission is to become the go-to framework for AI portfolio management agents
</p>
<p align="center">
It powers the <a href="https://app.listen-rs.com/">Listen App</a>, check it out to see what <code>listen</code> framework is capable of
## Listen Architecture
```mermaid
graph TB
subgraph "Rig Agent Kit by Listen"
RAK[RIG Agent Kit]
RAK_MT[Multi-tenant Stream Manager]
RAK_WALLET[Delegated Wallet Manager]
RAK --> RAK_MT
RAK --> RAK_WALLET
end
subgraph "Listen Trading Engine"
LTE[Trading Engine]
ORDER_COL[Order Collector]
PIPE[Pipeline Executor]
EXEC[Order Executor]
ORDER_COL --> PIPE
PIPE --> EXEC
LTE --> ORDER_COL
end
subgraph "Listen Data Service"
LDS[Data Service]
SUB[Substreams Indexer]
DB[(Clickhouse OLAP)]
PRICE[Price Stream]
SUB -->|Index Solana Slots| DB
LDS --> PRICE
LDS --> DB
end
%% External Systems
MOBILE[Mobile App]
CHAIN((Blockchain))
PRIVY((Privy))
WALLET[(Solana/EVM Wallets)]
%% Connections
RAK -->|Tool Calls| CHAIN
RAK -->|Execute Trades| LTE
LDS -->|Pricing Updates| LTE
LDS -->|Enriched Data| MOBILE
MOBILE -->|User Intents| RAK
LTE -->|Sign & Send Tx| CHAIN
DB -->|Query Data| RAK
RAK_WALLET -->|Integration| PRIVY
PRIVY --> WALLET
```
## Features
- 🔍 Real-time transaction monitoring
- 💱 Multi-DEX swap execution (Pump.fun, Jupiter V6 API or Raydium)
- 🚀 Blazingly fast transactions thanks to Jito MEV bundles
- 📊 Price tracking and metrics
- 🧰 Token management utilities
- 📈 Performance monitoring with Prometheus integration
And more!
It works plug'n'play with [$arc rig
framework](https://github.com/0xPlaygrounds/rig) framework allowing AI Agents
interact with the Solana blockchain, see example:
[src/agent.rs](https://github.com/piotrostr/listen/blob/main/src/agent.rs) and
the output [image](https://github.com/piotrostr/listen/blob/main/example.png).
For complete rundown of features, check out the CLI output of `cargo run` or the
[documentation](https://docs.listen-rs.com/).
## Quickstart
To play around with listen-rs, you can use the UI
Fill in the `.env.example` and `./dashboard/.env.example`, copy over to `.env` and `./dashboard/.env.example`, then
```
docker compose up
```
You can then access the dashboard over `http://localhost:4173`
> [!WARNING]
> listen-rs is undergoing rapid iterations, some things might not work and there could be breaking changes
## Requirements
1. **System Dependencies**
- Rust (with nightly toolchain)
- `protoc`
- `build-essential`
- `pkg-config`
- `libssl-dev`
2. **Configuration**
- Copy `.env.example` to `.env`
- Set up `auth.json` for JITO authentication (optional, gRPC HTTP/2.0 searcher client)
- Populate `fund.json`
Both keypairs are in `solana-keygen` format, array of 64 bytes, 32 bytes
private key and 32 bytes public key.
## Quick Start
```bash
# Install dependencies
sudo apt install protoc build-essential pkg-config libssl-dev
# Build
cargo build --release
# Run services
./run-systemd-services.sh
```
## Usage Examples
### Transaction Monitoring
```bash
cargo run -- listen \
--worker-count [COUNT] \
--buffer-size [SIZE]
```
### Token Swapping
```bash
cargo run -- swap \
--input-mint sol \
--output-mint EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v \
--amount 10000000
```
> [!WARNING]
> Default configuration is set for mainnet with small transactions. Ensure proper configuration for testnet usage and carefully review code before execution.
## Metrics and Monitoring
Listen includes built-in metrics exposed at `localhost:3030/metrics`. To visualize:
1. Start Prometheus:
```bash
prometheus --config=prometheus.yml
```
2. Access metrics at `localhost:3030/metrics`
Grafana should show something like this
<img
width="910"
alt="image"
src="https://github.com/piotrostr/listen/assets/63755291/95668158-9f7d-4cd2-be84-7c2b893d3f5c">
## Advanced Usage
### Swap Profiling
The `stackcollapse.pl` can be installed through
```sh
gh repo clone brendangregg/FlameGraph && \
sudo cp FlameGraph/stackcollapse.pl /usr/local/bin && \
sudo cp FlameGraph/flamegraph.pl /usr/local/bin
```
Profile swap performance using DTrace to produce a flamegraph:
```bash
./hack/profile-swap.sh
```
<img width="1210" alt="image" src="https://github.com/piotrostr/listen/assets/63755291/699405b7-adf0-448b-89c1-ba71152dc72b">
", Assign "at most 3 tags" to the expected json: {"id":"12700","tags":[]} "only from the tags list I provide: [{"id":77,"name":"3d"},{"id":89,"name":"agent"},{"id":17,"name":"ai"},{"id":54,"name":"algorithm"},{"id":24,"name":"api"},{"id":44,"name":"authentication"},{"id":3,"name":"aws"},{"id":27,"name":"backend"},{"id":60,"name":"benchmark"},{"id":72,"name":"best-practices"},{"id":39,"name":"bitcoin"},{"id":37,"name":"blockchain"},{"id":1,"name":"blog"},{"id":45,"name":"bundler"},{"id":58,"name":"cache"},{"id":21,"name":"chat"},{"id":49,"name":"cicd"},{"id":4,"name":"cli"},{"id":64,"name":"cloud-native"},{"id":48,"name":"cms"},{"id":61,"name":"compiler"},{"id":68,"name":"containerization"},{"id":92,"name":"crm"},{"id":34,"name":"data"},{"id":47,"name":"database"},{"id":8,"name":"declarative-gui "},{"id":9,"name":"deploy-tool"},{"id":53,"name":"desktop-app"},{"id":6,"name":"dev-exp-lib"},{"id":59,"name":"dev-tool"},{"id":13,"name":"ecommerce"},{"id":26,"name":"editor"},{"id":66,"name":"emulator"},{"id":62,"name":"filesystem"},{"id":80,"name":"finance"},{"id":15,"name":"firmware"},{"id":73,"name":"for-fun"},{"id":2,"name":"framework"},{"id":11,"name":"frontend"},{"id":22,"name":"game"},{"id":81,"name":"game-engine "},{"id":23,"name":"graphql"},{"id":84,"name":"gui"},{"id":91,"name":"http"},{"id":5,"name":"http-client"},{"id":51,"name":"iac"},{"id":30,"name":"ide"},{"id":78,"name":"iot"},{"id":40,"name":"json"},{"id":83,"name":"julian"},{"id":38,"name":"k8s"},{"id":31,"name":"language"},{"id":10,"name":"learning-resource"},{"id":33,"name":"lib"},{"id":41,"name":"linter"},{"id":28,"name":"lms"},{"id":16,"name":"logging"},{"id":76,"name":"low-code"},{"id":90,"name":"message-queue"},{"id":42,"name":"mobile-app"},{"id":18,"name":"monitoring"},{"id":36,"name":"networking"},{"id":7,"name":"node-version"},{"id":55,"name":"nosql"},{"id":57,"name":"observability"},{"id":46,"name":"orm"},{"id":52,"name":"os"},{"id":14,"name":"parser"},{"id":74,"name":"react"},{"id":82,"name":"real-time"},{"id":56,"name":"robot"},{"id":65,"name":"runtime"},{"id":32,"name":"sdk"},{"id":71,"name":"search"},{"id":63,"name":"secrets"},{"id":25,"name":"security"},{"id":85,"name":"server"},{"id":86,"name":"serverless"},{"id":70,"name":"storage"},{"id":75,"name":"system-design"},{"id":79,"name":"terminal"},{"id":29,"name":"testing"},{"id":12,"name":"ui"},{"id":50,"name":"ux"},{"id":88,"name":"video"},{"id":20,"name":"web-app"},{"id":35,"name":"web-server"},{"id":43,"name":"webassembly"},{"id":69,"name":"workflow"},{"id":87,"name":"yaml"}]" returns me the "expected json"