Twitter Discord

Welcome to GhostTag! πŸ‘»

Effortlessly tag, stream and filter Ethereum transactions with GhostTag.

πŸ”΄ Permissionless πŸ”΅ Free 🟒 Onchain

πŸ”΄ Real-time Streaming

Connect to any Ethereum-compatible network and start streaming transactions as they happen. Stay up-to-date with the latest transaction data.

πŸ”΅ Custom Tag Filtering

Filter transactions based on specific tags. Track exactly what you need, whether it’s for analytics, auditing, or custom notifications.

🟒 Silent Mode

Need a cleaner output? Enable silent mode to suppress console logging. Perfect for production environments.

🟑 Easy Integration

Built on top of ethers.js, GhostTag integrates seamlessly with your existing Ethereum projects.

🟠 Any Network

GhostTag can be used with any Ethereum-compatible network, including mainnet, testnets like Rinkeby, and private networks.

πŸ”΅ Fully Backward Compatible

GhostTag ensures full backward compatibility with already deployed contracts by attaching data to transactions, making integration effortless.

How It Works

1. Install GhostTag

npm install ghosttag

2. Stream Transactions


const { GhostTagStreamer } = require('ghosttag');
const { ethers } = require('ethers');

const rpcUrl = 'https://1rpc.io/holesky';
const tag = 'mytag'; // can be empty for no tag filter
const dataKeys = ['tag1', 'tag2']; // can be empty for no keys and just use tag
const silent = false;

const transactions = [];
const streamer = new GhostTagStreamer(rpcUrl, tag, dataKeys, silent);

// Add filters if needed
// Example filter: only include transactions from a specific address
// streamer.addFilter((tx, data) => tx.from === '0xYourAddress');

// Add a filter for a specific tag key
// streamer.addTagKeyFilter('tag1');

// Start watching transactions and update the transactions array
streamer.start((tx) => {
    transactions.push(tx);
    console.log('Transaction:', tx);
});
                    

3. Tag Transactions


const { TaggedContract } = require('ghosttag');
const { ethers } = require('ethers');

async function main() {
    const rpcUrl = 'YOUR_RPC_URL';  // Replace with your Ethereum-compatible network RPC URL
    const provider = new ethers.JsonRpcProvider(rpcUrl);
    const wallet = new ethers.Wallet('YOUR_PRIVATE_KEY', provider);

    const ContractABI = [
        "function fn(address To, uint256 Amount) external"
    ];

    const ContractAddress = 'YOUR_CONTRACT_ADDRESS';

    const contract = new ethers.Contract(ContractAddress, ContractABI, wallet);

    const To = "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913";
    const Amount = 1;

    let taggedContract = new TaggedContract(contract);

    const data = { tag1: 'cat', tag2: 'lol' };

    let tx = await taggedContract.fn(To, Amount).tag('mytag' + JSON.stringify(data));
    await tx.wait();
    console.log('Transaction mined:', tx.hash);

    tx = await taggedContract.fn(To, Amount).hextag('1337');
    await tx.wait();
    console.log('Transaction mined:', tx.hash);
}

main();