Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions exp/tools/ttp_poc/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Generated code directories
**/gen/

ttp_grpc_server

# Vendored proto files
**/cli_tool/protos/ingest/
**/consumer_app/protos/

# Node.js
**/node_modules/
**/dist/
.env

.vscode/
*.swp
*.swo

.DS_Store
37 changes: 37 additions & 0 deletions exp/tools/ttp_poc/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# TTP POC
example of Token transfer Processor [TTP](../../../ingest/processors/token_transfer/token_transfer_processor.go) as a GRPC server which streams events to a node js application as the grpc consumer.

![TTP gRPC Diagram](./ttp_grpc.png)

## in one terminal, run the TTP grpc server

install protoc
- on mac, `brew install protobuf`


Install protoc Go plugins globally, make sure your PATH includes GOPATH/bin or GOBIN
- `go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.28`
- `go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.2`


build and run the server
```
cd cli_tool
make build-server
RPC_ENDPOINT=https://soroban-testnet.stellar.org NETWORK_PASSPHRASE="Test SDF Network ; September 2015" ./ttp_grpc_server
```

## in another terminal, run an example consumer app
This example is in node, and it builds a grpc client from the protos to connect and consume events from the TTP grpc server
Make sure to have **Node >= 22** installed locally on host
```
cd consumer_app
make build-node
cd node
# run the ts directly
npm start -- <testnet start ledger> <testnet end ledger>
# or run the compiled js
node dist/index.js <testnet start ledger> <testnet end ledger>
```


42 changes: 42 additions & 0 deletions exp/tools/ttp_poc/cli_tool/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
.PHONY: all init gen-proto build-server
.SILENT:

PROTOS_BASE_URL := https://raw.githubusercontent.com/stellar/go/master/protos

all: build-server

# Initialize Go module and install dependencies
init:
set -e
rm -rf go/gen > /dev/null 2>&1
mkdir -p go/gen > /dev/null 2>&1
rm -rf protos/ingest/processors/token_transfer > /dev/null 2>&1
mkdir -p protos/ingest/processors/token_transfer > /dev/null 2>&1
rm -rf protos/ingest/asset > /dev/null 2>&1
mkdir -p protos/ingest/asset > /dev/null 2>&1

curl -s -o protos/ingest/processors/token_transfer/token_transfer_event.proto $(PROTOS_BASE_URL)/ingest/processors/token_transfer/token_transfer_event.proto
curl -s -o protos/ingest/asset/asset.proto $(PROTOS_BASE_URL)/ingest/asset/asset.proto
echo "✓ Init completed"


gen-proto: init
# Generate Go code from proto files
set -e
protoc \
--proto_path=./protos \
--go_out=go/gen \
--go_opt=Mingest/processors/token_transfer/token_transfer_event.proto=github.com/stellar/go/ingest/processors/token_transfer \
--go_opt=Mingest/asset/asset.proto=github.com/stellar/go/ingest/asset \
--go_opt=paths=source_relative \
--go-grpc_out=go/gen \
--go-grpc_opt=Mingest/processors/token_transfer/token_transfer_event.proto=github.com/stellar/go/ingest/processors/token_transfer \
--go-grpc_opt=Mingest/asset/asset.proto=cgithub.com/stellar/go/ingest/asset \
--go-grpc_opt=paths=source_relative \
event_service/event_service.proto > /dev/null 2>&1
echo "✓ Proto generation completed"

build-server: gen-proto
set -e
cd go && go build -o ../ttp_grpc_server main.go
echo "✓ Server build completed"
86 changes: 86 additions & 0 deletions exp/tools/ttp_poc/cli_tool/go/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
module cli_tool

go 1.23

toolchain go1.23.7

require (
github.com/stellar/go v0.0.0-20250322075617-5ccaef04a539
github.com/stellar/stellar-rpc v0.9.6-0.20250130160539-be7702aa01ba
google.golang.org/grpc v1.71.0
google.golang.org/protobuf v1.36.5
)

require (
cloud.google.com/go v0.114.0 // indirect
cloud.google.com/go/auth v0.5.1 // indirect
cloud.google.com/go/auth/oauth2adapt v0.2.2 // indirect
cloud.google.com/go/compute/metadata v0.6.0 // indirect
cloud.google.com/go/iam v1.1.8 // indirect
cloud.google.com/go/storage v1.42.0 // indirect
github.com/Masterminds/squirrel v1.5.4 // indirect
github.com/Microsoft/go-winio v0.6.1 // indirect
github.com/aws/aws-sdk-go v1.45.27 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/cenkalti/backoff/v4 v4.3.0 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/creachadair/jrpc2 v1.2.0 // indirect
github.com/creachadair/mds v0.13.4 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/djherbis/fscache v0.10.1 // indirect
github.com/felixge/httpsnoop v1.0.4 // indirect
github.com/go-errors/errors v1.5.1 // indirect
github.com/go-logr/logr v1.4.2 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/google/go-cmp v0.7.0 // indirect
github.com/google/s2a-go v0.1.7 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/googleapis/enterprise-certificate-proxy v0.3.2 // indirect
github.com/googleapis/gax-go/v2 v2.12.4 // indirect
github.com/hashicorp/golang-lru v1.0.2 // indirect
github.com/jmespath/go-jmespath v0.4.0 // indirect
github.com/jmoiron/sqlx v1.3.5 // indirect
github.com/klauspost/compress v1.17.6 // indirect
github.com/lann/builder v0.0.0-20180802200727-47ae307949d0 // indirect
github.com/lann/ps v0.0.0-20150810152359-62de8c46ede0 // indirect
github.com/lib/pq v1.10.9 // indirect
github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0 // indirect
github.com/pelletier/go-toml v1.9.5 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/prometheus/client_golang v1.17.0 // indirect
github.com/prometheus/client_model v0.5.0 // indirect
github.com/prometheus/common v0.45.0 // indirect
github.com/prometheus/procfs v0.12.0 // indirect
github.com/segmentio/go-loggly v0.5.1-0.20171222203950-eb91657e62b2 // indirect
github.com/sirupsen/logrus v1.9.3 // indirect
github.com/stellar/go-xdr v0.0.0-20231122183749-b53fb00bcac2 // indirect
github.com/stretchr/objx v0.5.2 // indirect
github.com/stretchr/testify v1.10.0 // indirect
go.opencensus.io v0.24.0 // indirect
go.opentelemetry.io/auto/sdk v1.1.0 // indirect
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.49.0 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.49.0 // indirect
go.opentelemetry.io/otel v1.34.0 // indirect
go.opentelemetry.io/otel/metric v1.34.0 // indirect
go.opentelemetry.io/otel/trace v1.34.0 // indirect
golang.org/x/crypto v0.32.0 // indirect
golang.org/x/exp v0.0.0-20231006140011-7918f672742d // indirect
golang.org/x/mod v0.17.0 // indirect
golang.org/x/net v0.34.0 // indirect
golang.org/x/oauth2 v0.25.0 // indirect
golang.org/x/sync v0.10.0 // indirect
golang.org/x/sys v0.29.0 // indirect
golang.org/x/text v0.21.0 // indirect
golang.org/x/time v0.5.0 // indirect
golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect
google.golang.org/api v0.183.0 // indirect
google.golang.org/genproto v0.0.0-20240528184218-531527333157 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20250106144421-5f5ef82da422 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20250115164207-1a7da9e5054f // indirect
gopkg.in/djherbis/atime.v1 v1.0.0 // indirect
gopkg.in/djherbis/stream.v1 v1.3.1 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
Loading
Loading