This project is a proof-of-concept (POC) to demonstrate how to use Kafka, blockchain and Kafka connectors to stream blockchain data (blocks, transactions, and events) into Kafka.
npm install
docker compose up -d
npm run start:producer
npm run start:consumer
Navigate to localhost:9021 in your favorite browser.
- Spin up Ganache locally (in separate terminal)
npx ganache-cli
- Capture ganache-cli output values for
Mnemonic
andListening on...
> Mnemonic: escape fluid width tooth below review ask spy outside velvet ivory timber
> Listening on 127.0.0.1:8545
- Update port only in
web3_rpc_url
in/kafka-web3-connector/ganache.config.properties
- Since we're using Docker containers, you need to keep he host.docker.internal
- Update your mnemonic seed phrase in
ganacheMnemonic
in/quickstart/spamTransactions.js
- Setup & Run one of the Kafka connectors. See individual README:
- kafka-web3-connector (recommended)
- kafka-ethereum-connector
- Once the connector is running, you can create blockchain transactions to watch the connector, in realtime, streaming blocks and transactions to Kafka.
npm run seed 5
- I used Confluent's Control Center UI to create a topic called
test
. Then you can run the quickstart producer and consumer scripts. - Then ran
npm run start:producer
in one terminal - Run
npm run start:consumer
in another terminal
To bring everything down:
docker compose down
See individual README in /kafka-ethereum-connector and /kafka-web3-connector