xDomain Transaction Monitoring
How to monitor transaction status
There are 4 different mechanisms for following the status of a transaction.
  1. 1.
    The Boba Blockexplorer (for L2) and Etherscan (for L1)
  2. 2.
    Running a typescript watcher
  3. 3.
    Using the Boba watcher-api
  4. 4.
    Third-party analytics

1. Blockexplorer

Mainnet Blockexplorer : https://blockexplorer.boba.network/address/____VALUE____/transactions Rinkeby Blockexplorer: https://blockexplorer.rinkeby.boba.network/address/____VALUE____/transactions

2. Running a watcher

Internally in all the services, and also in the gateway, the status of all transactions in monitored through a typescript watcher. See https://github.com/omgnetwork/optimism-v2/blob/develop/integration-tests/test/shared/watcher-utils.ts. Here is some generic pseudocode:
1
import { Watcher } from '@eth-optimism/core-utils'
2
3
this.watcher = new Watcher({
4
l1: {
5
provider: this.L1Provider,
6
messengerAddress: this.L1MessengerAddress,
7
},
8
l2: {
9
provider: this.L2Provider,
10
messengerAddress: this.L2MessengerAddress,
11
},
12
})
13
14
//Move ETH from L1 to L2 using the standard deposit system
15
depositETHL2 = async (value_Wei_String) => {
16
17
try {
18
19
const depositTxStatus = await this.L1StandardBridgeContract.depositETH(
20
this.L2GasLimit,
21
utils.formatBytes32String(new Date().getTime().toString()),
22
{
23
value: value_Wei_String
24
}
25
)
26
27
//at this point the tx has been submitted, and we are waiting...
28
await depositTxStatus.wait()
29
30
const [l1ToL2msgHash] = await this.watcher.getMessageHashesFromL1Tx(
31
depositTxStatus.hash
32
)
33
console.log(' got L1->L2 message hash', l1ToL2msgHash)
34
35
const l2Receipt = await this.watcher.getL2TransactionReceipt(
36
l1ToL2msgHash
37
)
38
console.log(' completed Deposit! L2 tx hash:', l2Receipt.transactionHash)
39
40
return l2Receipt
41
} catch(error) {
42
console.log("NS: depositETHL2 error:",error)
43
return error
44
}
45
}
Copied!

3. Using the Boba Transaction API

The system is documented here: https://github.com/omgnetwork/optimism-v2/tree/develop/ops_boba/api/watcher-api.
Mainnet Endpoint: https://api-watcher.mainnet.boba.network/ Rinkeby Endpoint: https://api-watcher.rinkeby.boba.network/
For example, to get L2 transactions between two blocks, use get.l2.transactions:

get.l2.transactions

Request Body
1
{
2
address: "ACCOUNT",
3
from: "NUMBER",
4
to: "NUMBER"
5
}
Copied!
Response Body
1
[
2
{
3
hash: "TRANSACTION_HASH",
4
blockNumber: "BLOCK_NUMBER",
5
from: "FROM_ACCOUNT",
6
to: "TO_ACCOUNT",
7
timestamp: "BLOCK_TIMESTAMP",
8
exitL2: "EXIT_L2", // True or False
9
crossDomainMessage: {
10
crossDomainMessage: "CROSS_DOMAIN_MESSAGE", // whether the transaction sent cross domain message
11
crossDomainMessageFinalize: "CROSS_DOMAIN_MESSAGE_FINALIZED", // whether the cross domain message is finalized on L1
12
crossDomainMessageSendTime: "CROSS_DOMAIN_MESSAGE_FINALIZED_TIME", // when the cross domain message is finalized
13
crossDomainMessageEstimateFinalizedTime: "ESTIMATE_CROSS_DOMAIN_MESSAGE_FINALIZED_TIME",
14
fast: "FAST_RELAY", // Whether the message is using the fast message relayer
15
l1Hash: "L1_HASH", // L1 hash of the cross domain message
16
l1BlockNumber: "L1_BLOCK_NUMBER",
17
l1BlockHash: "L1_BLOCK_HASH",
18
l1From: "L1_FROM",
19
l1To: "L1_TO"
20
},
21
stateRoot: {
22
stateRootHash: "L1_STATE_ROOT_HASH",
23
stateRootBlockNumber: "L1_STATE_ROOT_BLOCK_NUMBER",
24
stateRootBlockHash: "L1_STATE_ROOT_BLOCK_HASH",
25
stateRootBlockTimestamp: "L1_STATE_ROOT_BLOCK_TIMESTAMP"
26
},
27
action: {
28
sender: "EXIT_SENDER", // The address of L2 token sender
29
to: "EXIT_RECEIVER", // The address of L1 token receiver
30
token: "EXIT_TOKEN", // L2 token address
31
amount: "EXIT_AMOUNT", // L2 exit amount, which doesn't consider fee
32
receive: "EXIT_RECEIVE", // L1 received amount
33
feeRate: "EXIT_FEE",
34
relay: "FAST_RELAY",
35
status: "STATUS" // pending || succeeded || reverted
36
}
37
}
38
]
Copied!

4. Using Third Party Analytics

Some teams prefer to use providers such as https://thegraph.com/en/, which is available on Boba as well.
Last modified 1mo ago