Architecture¶
Overview¶
The Ethereum Alarm Clock infrastructure consists of the following contracts:
TransactionRequest
: Represents a single scheduled transaction.RequestFactory
: Low level API for creatingTransactionRequest
contracts.RequestTracker
: Tracks the scheduled transactions.BlockScheduler
: High level API for creatingTransactionRequest
contracts configured to be executed at a specified block number.TimestampScheduler
: High level API for creatingTransactionRequest
contracts configured to be executed at a certain time, as specified by a timestamp.
Note
Actual functionality of most of the contracts is housed separately in various libraries.
-
class
RequestTracker
RequestTracker¶
The RequestTracker
is a database contract which tracks upcoming
transaction requests. It exposes an API suitable for someone wishing to
execute transaction requests to be able to query which requests are scheduled
next as well as other common needs.
The RequestTracker
database indexes requests based on the address that submits them.
Therefore, the RequestTracker
is un-permissioned and allows any address
to report scheduled transactions and to have them stored in their own personal
index. The address which submits the transaction request is referred to as the
scheduler address.
The flexibility of the RequestTracker storage enables those executing transaction requests to choose which scheduler addresses they wish to watch for upcoming transactions.
-
class
RequestFactory
RequestFactory¶
The RequestFactory
contract is designed to be a low-level interface
for developers who need fine-grained control over all of the various
parameters that the TransactionRequest
can be configured with.
Parameter validation is available, but not mandatory.
It provides an API for creating new TransactionRequest
contracts.
-
class
BlockScheduler
¶
-
class
TimestampScheduler
¶
BlockScheduler and TimestampScheduler¶
The BlockScheduler
and TimestampScheduler
contracts are a
higher-level interface that most developers should want to use in order to
schedule a transaction for a future block or timestamp.
Both contracts present an identical API for creating new
TransactionRequest
contracts. Different from RequestFactory
,
request parameters are always validated.
BlockScheduler
treats all of the scheduling parameters as meaning
block numbers, while TimestampScheduler
treats them as meaning
timestamps and seconds.