Smart contract and wallet monitoring
What is smart contract and wallet monitoring?
Smart contract and wallet monitoring is watching the contracts you deployed and the wallets you control for attacks and unexpected changes, such as a large outflow or an admin setting changed by a caller you didn’t expect.
Banks, stablecoin issuers and custody providers that run contracts or hold funds onchain set it up as part of security operations, so their team hears about suspicious activity as it happens and can act on it, for example by pausing the contract.
Goldsky decodes activity on the addresses you list, alerts your team when a rule trips and can run a task that pauses the contract under rules you set; which activity counts as an attack, whether to pause automatically and when to resume stay with your security team.
You can build it two ways: a Turbo Pipelines pipeline that decodes activity on your contracts and wallets and calls a Compose task to pause, or a subgraph on your contracts that sends a webhook for each sensitive event, which starts the same kind of task.
Who uses smart contract and wallet monitoring?
Global banks, stablecoin issuers and custody and wallet infrastructure providers that run their own contracts or hold funds onchain.
How smart contract monitoring catches an attack and pauses
Follow one suspicious transaction on your contract from the chain to the pause, then to your security team’s review and unpause. Your setup may differ.
Ways to monitor your smart contracts and wallets
The pipeline reads activity on any address you list, plain wallets included, and applies your rule in SQL; the subgraph indexes your own contracts’ events through mappings, and the rule lives in the task its webhook starts.
- Best for
- Contracts and wallets, with rules on single events
- What you run
- The destination: your database, queue or bucket, or a Postgres database Goldsky hosts
- What you write
- Pipeline YAML and SQL; TypeScript transforms when needed
- Where your data lives
- In your own database or systems
- How results reach you
- Pushed to you
- Best for
- A few of your own contracts, described in a schema
- What you run
- Nothing; Goldsky runs indexing, storage and the API
- What you write
- A schema and mapping handlers, or a no-code or low-code config for simple contracts
- Where your data lives
- Hosted by Goldsky
- How results reach you
- You query; changes are pushed
| Usual setupOption 1: Stream, alert and pause | Option 2: Subgraph webhooks and a task | |
|---|---|---|
| Best for | Contracts and wallets, with rules on single events | A few of your own contracts, described in a schema |
| Products | TurboCompose | SubgraphsCompose |
| What you run | The destination: your database, queue or bucket, or a Postgres database Goldsky hosts | Nothing; Goldsky runs indexing, storage and the API |
| What you write | Pipeline YAML and SQL; TypeScript transforms when needed | A schema and mapping handlers, or a no-code or low-code config for simple contracts |
| Where your data lives | In your own database or systems | Hosted by Goldsky |
| How results reach you | Pushed to you | You query; changes are pushed |
Keep a watch list of your contracts and wallets
Handled by Goldsky TurboYou can only catch activity on addresses you’re watching, so the list comes first.
Your security team lists every contract you deployed and every wallet that holds funds or admin rights, on each chain, and keeps the list current as you deploy and rotate. A wallet left off the list can be drained without anyone being alerted.
With Goldsky, the list can be a Turbo Pipelines dynamic table, which lives in a Postgres database. Add a new contract’s address and the running pipeline starts watching it.
Learn about dynamic tables (opens in a new tab)Suspicious activity hits your contract
An attack shows up onchain as transactions: funds moving out, or a setting changed.
The transaction is public once it’s in a block, and more transactions in the same attack can follow in the next blocks. The newest blocks can still be replaced for a short time (a reorg), so what you see first isn’t final.
Decode activity on your addresses
Handled by Goldsky TurboRaw transactions have to become named events and values before a rule can read them.
Every event touching a watched address has to be decoded with the contract’s ABI into fields such as the function, the caller and the amount. An event the decoder doesn’t recognize can’t trip any rule, so the ABIs have to stay current with each upgrade.
Turbo Pipelines decodes each log with
Decode logs in SQL (opens in a new tab)_gs_log_decode()and the contract’s ABI, and keeps only those from addresses on your watch list usingdynamic_table_check().Raise the alarm when a rule trips
Handled by Goldsky TurboYour security team has to hear about a suspicious event while the attack may still be under way.
A rule is a condition on one event, such as an outflow above a threshold or an admin call from an unexpected caller, and every match goes to your alerting tool with the transaction attached. Rules about something missing, or a total over time, need a scheduled check instead.
Goldsky can filter the decoded rows with your rule in a SQL transform and post each match to your alerting tool through a webhook sink, one request per match.
Set up the webhook sink (opens in a new tab)Pause the contract under your rules
Handled by Goldsky ComposeA pause stops further transfers or payouts while your team works out what happened.
Pausing takes a transaction from a wallet that holds the pause role, so decide in advance whether a task may pause automatically, and on which rules. If you’d rather not give any automated wallet that role, keep the alert and have a person pause.
A second webhook sink can call a Compose task’s HTTP trigger; the task checks the alert against your rules and calls the pause function from a Compose wallet that holds the role. Compose carries the call through brief failures and traces each step for the incident review.
Send calls from a Compose wallet (opens in a new tab)The contract is paused
Once the pause transaction is in a block, the contract refuses the calls the pause covers.
What stops depends on how your contract implements the pause, so check which functions it blocks before you rely on it. Transactions included before the pause have already gone through.
Investigate and resume
Someone has to work out what happened and decide when it’s safe to carry on.
Your security team reviews the alert, the decoded events and the record of what the task did, fixes the cause, then unpauses through your normal approval process. Resuming before the cause is fixed leaves the contract open to the same attack.
What to know about watching contracts with a pipeline
- A rule in the pipeline looks at one row at a time, so conditions on totals or time windows, such as outflows over a day, belong in a scheduled task or your own systems.
- The alert fires when a transaction is seen, before it’s final, and the webhook receiver gets a correction record if a reorg removes it.
- Pausing automatically means giving the task’s wallet the pause role on your contract; you can keep the alert and pause by hand instead.
- Goldsky runs the pipeline and the task; the addresses, the rules and the decision to resume are yours.
Describe the events to watch
A subgraph only records the events its mappings handle, so you choose them up front.
Your team writes a schema for the records to watch, such as admin changes and large withdrawals, and mappings that create one from each event. An event you leave out of the mappings is invisible to every alert built on this index.
Suspicious activity hits your contract
An attack shows up onchain as transactions: funds moving out, or a setting changed.
The transaction is public once it’s in a block, and more transactions in the same attack can follow in the next blocks. The newest blocks can still be replaced for a short time (a reorg), so what you see first isn’t final.
Index your contracts’ events
Handled by Goldsky SubgraphsEach event has to become a record before anything can react to it.
Indexing has to keep up with new blocks and follow reorgs, so a record from a replaced block is rolled back. Indexing that falls behind delays every alert queued after it.
Goldsky Subgraphs runs your mappings on each new block and keeps every version of a record with its
Index onchain data with subgraphs (opens in a new tab)block_range, which is how a reorg rollback shows up.Send each change toward the task
Handled by Goldsky SubgraphsThe task can only act on events it hears about.
Each new or changed record goes out with its operation (insert, update or delete), so the receiver can tell a fresh event from a rollback. Changes can arrive out of order, so the receiver keys its work on the record ID and block.
You can attach a webhook to the entity in Subgraphs with a
Set up subgraph webhooks (opens in a new tab)--secret, point it at an endpoint of yours that checks the secret, and have that endpoint call the Compose task’s HTTP trigger.Decide and pause under your rules
Handled by Goldsky ComposeA pause stops further transfers or payouts while your team works out what happened.
The task checks the event against your rule, alerts your team and, if the rule says so, sends the pause transaction from a wallet that holds the pause role. Whether any automated wallet gets that role is your security team’s decision.
Compose runs the rule as TypeScript, calls your alerting tool with
Send calls from a Compose wallet (opens in a new tab)fetchand sends the pause withwriteContractfrom a Compose wallet; every call is logged on the task run.The contract is paused
Once the pause transaction is in a block, the contract refuses the calls the pause covers.
What stops depends on how your contract implements the pause, so check which functions it blocks before you rely on it. Transactions included before the pause have already gone through.
Investigate and resume
Someone has to work out what happened and decide when it’s safe to carry on.
Your security team reviews the alert, the decoded events and the record of what the task did, fixes the cause, then unpauses through your normal approval process. Resuming before the cause is fixed leaves the contract open to the same attack.
What to know about monitoring with subgraph webhooks
- The webhook fires on record changes your mappings make, so an event the mappings ignore never reaches the task.
- A reorg arrives as a change to a record’s
block_range, which the task has to tell apart from an ordinary update. - Watching a new contract means changing the subgraph and deploying a new version.
- The rule is TypeScript in the task, so it can call your other systems before deciding to pause.
What you control
- Your team
- Investigate and resume
Security and deployment
- SOC 2 Type IIIndependently audited security controls.
- Dedicated infrastructureSingle-tenant options for production workloads.
- Data residencyCloud, on-premises or co-located.
More use cases that monitor transactions
- Compliance monitoringScreen wallets and transfers, watch for misuse of your assets and feed your AML and surveillance tools.
- Securities surveillanceScreen wallets and transfers, watch for misuse of your assets and feed your AML and surveillance tools.
- Crypto wallet screening and sanctions dataFlag transfers that touch sanctioned or high-risk addresses.
- Secondary-market sanctions sweeps for token issuersScreen every holder and transfer of your stablecoin, not only your direct customers.
- Data for crypto AML transaction monitoringFeed complete transfer data to AML tools with lineage from the chain to the case.
- Unauthorized tokenization monitoringFind tokens that claim to represent your security without your consent.
- Blockchain forensics data feedGive investigators full history and traces across chains.
- VASP and counterparty due diligence dataProfile a VASP, issuer or counterparty by its onchain exposure before onboarding it and while the relationship lasts.
- Crypto source of funds and wealth checksTrace where a client’s onchain funds came from to document legitimate wealth at onboarding.
- Token listing due diligence for exchangesCheck a token’s supply, holders, liquidity and risky links before an exchange lists it, and after.
- Crypto scam and money mule detection dataFlag payments to scam-linked wallets and customer accounts that act as money mules.
- Crypto wallet monitoringGet an alert when a watched wallet makes a large transfer, crosses a balance limit, wakes after dormancy or pays an unknown counterparty.
- Address poisoning detectionFlag the zero-value, dust and fake-token transfers that lookalike addresses plant in a user’s history, and warn before anyone pays one.
- Onchain supervisory monitoring for regulatorsGive examiners one view of licensed firms’ onchain activity to test against what the firms report.
Use cases built the same way
- Authorize and capture stablecoin paymentsHold a buyer’s stablecoins in an escrow contract at checkout, capture them to the merchant as orders ship, void what can’t be filled and refund after capture.
- Continuous proof of reservesCompare onchain supply with reported reserves on a schedule, then publish the ratio or alert on a gap.
- Sponsored gas spendTotal the gas you pay for your users per user, paymaster and day, watch the paymaster’s deposit and check the provider’s bill.
- Keep tokenized stocks backed one to oneCheck token supply on every chain against the shares or fund units held in custody, and alert on any gap.
Monitor your smart contracts and wallets with Goldsky
We’ll map it to your systems and show you what Goldsky runs, so your team builds the product, not the pipelines underneath it.