adder-publisher

command
v0.45.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 22, 2026 License: Apache-2.0 Imports: 6 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

Adder Publisher Example

This example demonstrates a basic Adder pipeline that connects to a Cardano node using ChainSync and publishes all events.

Description

This is the simplest example of using Adder as a library. It:

  • Connects to a Cardano node via Node-to-Client ChainSync protocol
  • Receives and logs all blockchain events
  • Auto-reconnects on connection loss
  • Starts syncing from the current chain tip

Configuration

The example uses environment variables for configuration:

  • CARDANO_NODE_SOCKET_PATH: Path to the Cardano node socket (default: /ipc/node.socket)
  • CARDANO_NODE_MAGIC: Network magic number (default: 764824073 for mainnet)
Network Magic Values
  • Mainnet: 764824073
  • Preview: 2
  • Preprod: 1

Running

Using a Local Node

If you have a synced Cardano node running locally:

export CARDANO_NODE_SOCKET_PATH=/path/to/node.socket
export CARDANO_NODE_MAGIC=764824073
go run main.go
Using a Remote Node

Alternatively, you can uncomment the WithAddress line in main.go to connect to a remote node:

// Uncomment this line:
input_chainsync.WithAddress("52.15.49.197:3001"),
// And comment out:
// input_chainsync.WithSocketPath(cfg.SocketPath),

Then run:

go run main.go

Expected Output

The program will output:

  • ChainSync status updates showing sync progress
  • Events for each block, transaction, and other blockchain activities

Example:

ChainSync status update: {Status: syncing, Tip: 12345678}
Received event: input.block
Received event: input.transaction
...

Code Structure

  • Config: Holds configuration parsed from environment variables
  • main(): Sets up the pipeline with input and output components
  • handleEvent(): Processes each event received from the blockchain
  • updateStatus(): Logs ChainSync status updates

Next Steps

Check out the other examples to learn how to:

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL