xDomain Transaction Monitoring
How to monitor transaction status
There are 4 different mechanisms for following the status of a transaction.
The Habtor Blockexplorer (for L2) and Bscscan (for L1)
Running a typescript
watcherUsing the Habtor
watcher-apiThird-party analytics
1. Blockexplorer
Mainnet Blockexplorer :
https://blockexplorer.habtorscan.com/address/____VALUE____/transactionsTestnet Blockexplorer:https://blockexplorer.testnet.habtorscan.com/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/habtorcom/optimism-v2/blob/develop/integration-tests/test/shared/watcher-utils.ts. Here is some generic pseudocode:
import { Watcher } from '@eth-optimism/core-utils'
this.watcher = new Watcher({
l1: {
provider: this.L1Provider,
messengerAddress: this.L1MessengerAddress,
},
l2: {
provider: this.L2Provider,
messengerAddress: this.L2MessengerAddress,
},
})
//Move ETH from L1 to L2 using the standard deposit system
depositETHL2 = async (value_Wei_String) => {
try {
const depositTxStatus = await this.L1StandardBridgeContract.depositETH(
this.L2GasLimit,
utils.formatBytes32String(new Date().getTime().toString()),
{
value: value_Wei_String
}
)
//at this point the tx has been submitted, and we are waiting...
await depositTxStatus.wait()
const [l1ToL2msgHash] = await this.watcher.getMessageHashesFromL1Tx(
depositTxStatus.hash
)
console.log(' got L1->L2 message hash', l1ToL2msgHash)
const l2Receipt = await this.watcher.getL2TransactionReceipt(
l1ToL2msgHash
)
console.log(' completed Deposit! L2 tx hash:', l2Receipt.transactionHash)
return l2Receipt
} catch(error) {
console.log("NS: depositETHL2 error:",error)
return error
}
}3. Using the Habtor Transaction API
The system is documented here: https://github.com/habtorcom/optimism-v2/tree/develop/ops_boba/api/watcher-api.
Mainnet Endpoint: https://api-watcher.mainnet.habtor.com/ Testnet Endpoint: https://api-watcher.testnet.habtor.com/
For example, to get L2 transactions between two blocks, use get.l2.transactions:
get.l2.transactions
Request Body
Response Body
4. Using Third Party Analytics
Some teams prefer to use providers such as https://thegraph.com/en/, which is available on Habtor as well.
Last updated