Skip to content

Conversation

@leighmcculloch
Copy link
Member

@leighmcculloch leighmcculloch commented Dec 1, 2025

What

Use the RPC backend support of friendbot instead of Horizon. Update startup script to wait for either RPC or Horizon based on configuration. Remove hardcoded horizon_url from config and dynamically inject the appropriate backend URL. Allow friendbot to start when only RPC is enabled without requiring Horizon.

Why

Friendbot previously required Horizon to fund accounts. With RPC support, friendbot can operate in RPC-only deployments without needing Horizon running. RPC is the preferred integration point, because in the future Friendbot will support funding contracts, and so even if both RPC and Horizon are available it will default to RPC to be able to support contract functionality.

Merging

Dependent on:

Cannot be merged until all images are updated to use a version of friendbot that contains the two dependent changes above.

Testing

This change includes a new image, friendbot-with-rpc, temporarily just while in pull request that can be used for testing the dependent changes above.

Close stellar/friendbot#5
Close #791

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request enables friendbot to use RPC as its backend instead of requiring Horizon, supporting RPC-only deployments. The changes allow friendbot to dynamically configure either RPC or Horizon backends, with RPC being the preferred option when both are available to support future contract funding functionality.

  • Removed hardcoded horizon_url from friendbot config and made backend URL injection dynamic based on which service is enabled
  • Updated startup scripts to conditionally wait for either RPC or Horizon based on friendbot's configuration
  • Removed the forced enabling of Horizon when RPC is enabled for local networks

Reviewed changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated 2 comments.

File Description
start Removed forced ENABLE_HORIZON when ENABLE_RPC is true; added dynamic backend URL injection in init_friendbot(); updated upgrade_local() to start friendbot when either RPC or Horizon is enabled
common/friendbot/etc/friendbot.cfg Removed hardcoded horizon_url to allow dynamic backend configuration
common/friendbot/bin/start Added conditional waiting logic for RPC and Horizon backends based on configuration file contents
images.json Added temporary "friendbot-with-rpc" image for testing the dependent friendbot changes with specific commit reference

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Contributor

@sreuland sreuland left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good, left one comment on friendbot startup config.

@leighmcculloch leighmcculloch marked this pull request as ready for review December 5, 2025 11:25
@leighmcculloch leighmcculloch marked this pull request as draft December 5, 2025 14:58
@leighmcculloch
Copy link
Member Author

TODO:

@leighmcculloch
Copy link
Member Author

leighmcculloch commented Dec 6, 2025

The intermittent race condition failure is difficult to debug because the container log collection is broken.

Opened issue to track fixing that:

And pull request with fix:

@leighmcculloch
Copy link
Member Author

This is an example of intermittent failure now that the logging has been fixed:

@leighmcculloch
Copy link
Member Author

These are Friendbot logs. It looks like it's failing trying to create the minion accounts.

Waiting for rpc to be available...
starting friendbot...
time="2025-12-07T23:31:03.005Z" level=info msg="Tracing disabled - using no-op tracer" pid=759
time="2025-12-07T23:31:03.005Z" level=info msg="Tracer initialized" pid=759
2025/12/07 23:31:03 Found all valid params, now creating 10 minions
2025/12/07 23:31:03 Creating 10 new minion accounts
time="2025-12-07T23:31:03.146Z" level=error msg="creating minion accounts: submitting create accounts tx: transaction rejected" pid=759

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Backlog (Not Ready)

Development

Successfully merging this pull request may close these issues.

Make horizon optional at build/runtime Add support for using RPC instead of Horizon

3 participants