transaction_sender

package module
v0.0.0-...-9b08581 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2025 License: MIT Imports: 20 Imported by: 0

README

Transaction Sender

Simple golang implementation for sending serialized transactions to SVM (Solana/Fogo) leaders with accurate leader tracking.

Transactions are sent via both QUIC & UDP to the leader processing N+1 slot via accurate leader tracking.

For most use cases outside TXN spam, users should be able to utilize this service over a hosted RPC solution as long as their tx flow is < SWQOS threshold.

Supported Protocols

  • Solana
  • Fogo

Features

  • Leader tracking
  • QUIC Support
  • UDP Support
Upcoming
  • Jito detection
  • Whitelist validator set
  • Pre-connect latency

Setup

Environment

To run the transaction sender simply provide it via env or flags

HTTP_PORT=8080
RPC_URL={RPC_ENDPOINT}
WS_URL={RPC_WS_ENDPOINT}
Flags
  • http_port - HTTP port to serve the endpoints on
  • rpc_url - RPC URL used to query for leader & slot detail
  • ws_url - RPC Websocket URL for inbound slot data

Build

Docker
  • Deploy via the supported Dockerfile
  • Connect to transaction sender via exposed port
Source
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -ldflags='-s -w -extldflags "-static"' -o txn_worker ./runtime/main.go -o transaction_sender

Development

go run ./runtime/main.go --rpc_url {RPC_URL}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Leader

type Leader struct {
	PubKey          string `json:"pubkey"`
	TPU             string `json:"tpu"`
	TPUForwards     string `json:"tpuForwards"`
	TPUQuic         string `json:"tpuQuic"`
	TPUForwardsQuic string `json:"tpuForwardsQuic"`
}

type LeaderMonitor

type LeaderMonitor struct {
	// contains filtered or unexported fields
}

func (*LeaderMonitor) Current

func (s *LeaderMonitor) Current(slotDiff uint64) (*Leader, uint64, error)

func (*LeaderMonitor) RelativeSlot

func (s *LeaderMonitor) RelativeSlot(slot uint64) uint64

func (*LeaderMonitor) Start

func (s *LeaderMonitor) Start() error

type RPCService

type RPCService struct {
	// contains filtered or unexported fields
}

func (*RPCService) ClusterNodes

func (s *RPCService) ClusterNodes(ctx context.Context, out interface{}) error

func (*RPCService) EpochInfo

func (s *RPCService) EpochInfo(ctx context.Context, out interface{}) error

func (*RPCService) LeaderSchedule

func (s *RPCService) LeaderSchedule(ctx context.Context, epoch *uint64, out interface{}) error

func (*RPCService) Load

func (s *RPCService) Load(rpcEndpoint, wsEndpoint string) error

func (*RPCService) Slot

func (s *RPCService) Slot(ctx context.Context) (uint64, error)

type SlotMessage

type SlotMessage struct {
	Params struct {
		Result struct {
			Parent uint64 `json:"parent"`
			Slot   uint64 `json:"slot"`
		} `json:"result"`
		Subscription uint64 `json:"subscription"`
	} `json:"params"`
}

type TPUService

type TPUService struct {
	// contains filtered or unexported fields
}

func (*TPUService) Connect

func (s *TPUService) Connect(ctx context.Context, leader *Leader) (*quic.Conn, error)

func (*TPUService) PreConnect

func (s *TPUService) PreConnect(ctx context.Context, l *Leader) error

func (*TPUService) Send

func (s *TPUService) Send(ctx context.Context, l *Leader, txBytes []byte) error

func (*TPUService) Start

func (s *TPUService) Start() error

type TransactionSender

type TransactionSender struct {
	// contains filtered or unexported fields
}

func NewTransactionSender

func NewTransactionSender(rpcEndpoint string, websocketEndpoint string) (*TransactionSender, error)

func (*TransactionSender) Send

func (s *TransactionSender) Send(ctx context.Context, txBytes []byte) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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