Schedule a Transaction
Scheduled transactions allow you to wrap any operation for deferred execution. The network holds the transaction until all required signatures are collected, then executes it automatically. This is the foundation for multi-party workflows where signers are not online at the same time.
Schedule a transfer
var receipt = await client.ScheduleAsync(new ScheduleParams
{
Transaction = new TransferParams
{
CryptoTransfers = new[]
{
new CryptoTransfer(sender, -amount),
new CryptoTransfer(receiver, amount)
}
},
Memo = "Scheduled transfer",
Expiration = new ConsensusTimeStamp(DateTime.UtcNow.AddHours(1))
});
Console.WriteLine($"Schedule ID: {receipt.Schedule}");
Convenience overload
If you don't need expiration, admin key, or payer overrides, schedule any TransactionParams directly:
var receipt = await client.ScheduleAsync(someTransferParams);
Collect additional signatures
Other parties add their signatures via SignScheduleAsync. Once every required key has signed, the scheduled transaction executes automatically:
// Party B signs from their own session
await client.SignScheduleAsync(scheduleId);
If the required key is not in the client's context, pass it explicitly:
await client.SignScheduleAsync(new SignScheduleParams
{
Schedule = scheduleId,
Signatory = new Signatory(partyBKey)
});
Delayed execution
Set DelayExecution = true to prevent execution even after all signatures are collected — the transaction waits until Expiration:
var receipt = await client.ScheduleAsync(new ScheduleParams
{
Transaction = transferParams,
DelayExecution = true,
Expiration = new ConsensusTimeStamp(DateTime.UtcNow.AddDays(7))
});
Key points
- Any
TransactionParamssubclass can be wrapped in a schedule — transfers, token creates, contract calls, etc. - If the schedule expires before all signatures are collected, it is deleted from state.
- Schedules created with an
Administratorkey can be cancelled viaDeleteScheduleAsync. - Query schedule status with
GetScheduleInfoAsync.