Skip to content

Add send/simulateTransaction support#13

Draft
cjonas9 wants to merge 14 commits intodevfrom
simulate-and-send-transactions
Draft

Add send/simulateTransaction support#13
cjonas9 wants to merge 14 commits intodevfrom
simulate-and-send-transactions

Conversation

@cjonas9
Copy link
Copy Markdown
Contributor

@cjonas9 cjonas9 commented Mar 2, 2026

Note: This PR is currently not to be reviewed, as significant changes to the base branch are underway.

What

Adds support for simulateTransaction and sendTransaction as load-testable RPC endpoints:

  • simulateTransaction builds a static PaymentToContract transaction with zero account IDs and zero destination contract IDs. Sent at rate RPS in a manner similar to non-data-dependent endpoints.
  • sendTransaction builds a pool of worker accounts funded by a provided source account. These worker accounts send signed self-payment transactions in parallel and are scheduled round-robin.
    • For sendTransaction, if one is testing on testnet, they have the option of not supplying a pre-funded user account. However, they may if they wish, and if they wish to test on pubnet, then they must. This can be specified in the toml file as a secret seed from which their keypair may be parsed.

Why

These are the final endpoints that must be supported by stellar-rpc-blaster, and differ from the others because they're not read-only. They require actual signed transaction envelopes rather than canned JSON parameters. This branch builds transaction construction, account lifecycle (source account -> workers seeded with funds -> workers coalesced into source account), and infrastructure needed to generate realistic load against these endpoints.

Known limitations

N/A

@cjonas9 cjonas9 linked an issue Mar 2, 2026 that may be closed by this pull request
Base automatically changed from generate-command to dev March 4, 2026 21:50
@cjonas9 cjonas9 force-pushed the simulate-and-send-transactions branch from 76bc86b to b4c0fa5 Compare March 6, 2026 09:09
@cjonas9 cjonas9 force-pushed the simulate-and-send-transactions branch from 018c56e to d6bfa8e Compare March 7, 2026 00:08
@cjonas9 cjonas9 marked this pull request as ready for review March 10, 2026 17:42
@cjonas9 cjonas9 requested a review from a team March 11, 2026 16:54
@cjonas9 cjonas9 requested a review from a team March 12, 2026 22:42
@cjonas9 cjonas9 moved this from To Do to Needs Review in Platform Scrum Mar 13, 2026
@cjonas9 cjonas9 added this to the platform sprint 69 milestone Mar 13, 2026
@cjonas9 cjonas9 requested a review from a team March 13, 2026 22:13
if endpointKey == "sendTransaction" {
numAccounts := uint32(min(rps, 100)) // cap # of accounts to lessen friendbot calls and account creation

logger.Warn("sendTransaction causes greater load on the RPC server than other endpoints!")
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Does it? It shouldn't..

if err != nil {
return "", fmt.Errorf("failed to submit create account transaction: %v", err)
}
if resp.Status == proto.TXStatusError {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

What about TryAgain?

}

w.Id.Store(seq + 1)
w.Balance.Swap(w.Balance.Load() - amount*int64(len(to)))
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This isn't accurate until the tx is confirmed, no?


// BuildSimulateTxB64 builds a base64-encoded PaymentToContract used for simulateTransaction calls.
// Uses zero contract/source accounts - no real accounts needed since this is never submitted on-chain.
func BuildSimulateTxB64(networkPassphrase string) (string, error) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Since send and simulate are disjoint, it'd be super helpful to be able to review these independently. In the interest of smaller PRs, could we decompose these into separate ones?

StroopsPerXLM = 1 * 1e7
FeeTolerance = 1000 // stroop-fee buffer to account for fee fluctuations when verifying balances

WorkerMergeRetryWindow = time.Second * 90
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Shouldn't this scale with MaxCreateAccountsPerTx?

sa := p.originAccount
accounts := make([]*WorkerAccount, numWorkers)
for i := range accounts {
workerKp, err := keypair.Random()
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

If we derive these deterministically from the base account, we can have a reproducible setup stage and make merges idempotent

Comment on lines +26 to +32
export ORIGIN_ACCOUNT_SECRET="S..."

./stellar-rpc-blaster run \
--rpc-url "https://your-rpc-host" \
--config-path "./internal/config/config.example.toml" \
--duration 30s \
--ramp-up 10s
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Recommend making the secret ephemerally available rather than globally for the shell duration:

Suggested change
export ORIGIN_ACCOUNT_SECRET="S..."
./stellar-rpc-blaster run \
--rpc-url "https://your-rpc-host" \
--config-path "./internal/config/config.example.toml" \
--duration 30s \
--ramp-up 10s
ORIGIN_ACCOUNT_SECRET="S..." ./stellar-rpc-blaster run \
--rpc-url "https://your-rpc-host" \
--config-path "./internal/config/config.example.toml" \
--duration 30s \
--ramp-up 10s

@cjonas9 cjonas9 moved this from Needs Review to To Do in Platform Scrum Mar 24, 2026
@cjonas9 cjonas9 removed this from Platform Scrum Apr 2, 2026
@cjonas9 cjonas9 removed this from the platform sprint 69 milestone Apr 2, 2026
@cjonas9 cjonas9 marked this pull request as draft April 3, 2026 17:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Client Load Testing: simulate and send transactions

2 participants