>

>

2. Extracting the Deployer

Spotting the Architect 🏗️

You’re doing great! Now, how do we find out who actually pushed the 'deploy' button? 🤔

Every time a contract is born, it leaves a trail in the event logs. We use filterRawEventLogs to scan those records.

When we find the creation event, we look at the txOrigin. This is the address that signed and submitted the transaction—the real architect!.

Think of a smart contract like a new building. The txOrigin is the developer who signed the blueprints, while the gasPayer is just the one who paid the building permits.

// Filter logs for our target contract address [2]
const filteredLogs = await thor.logs.filterRawEventLogs({
  criteriaSet: [{ address: contractAddress }],
});

// The architect is here! 💎
console.log('Deployer', filteredLogs.meta.txOrigin); [2]
// Filter logs for our target contract address [2]
const filteredLogs = await thor.logs.filterRawEventLogs({
  criteriaSet: [{ address: contractAddress }],
});

// The architect is here! 💎
console.log('Deployer', filteredLogs.meta.txOrigin); [2]
// Filter logs for our target contract address [2]
const filteredLogs = await thor.logs.filterRawEventLogs({
  criteriaSet: [{ address: contractAddress }],
});

// The architect is here! 💎
console.log('Deployer', filteredLogs.meta.txOrigin); [2]

Almost there! Just remember: txOrigin is an EOA (Externally Owned Account) controlled by a private key, not the contract itself.