Book a free call

Blockchain Security Best Practices for Teams That Ship

Blockchain security best practices that protect live protocols: audit before launch, guard keys with multisig, monitor transactions and rehearse incident response.

Hertiv engineering teamReviewed by a senior engineer
7 min read
Blockchain Security Best Practices for Teams That Ship
On this page

Short answer

Blockchain security best practices are the habits that keep a chain or dApp safe across its whole life: small audited contracts, keys held in multisig with time delays, continuous monitoring of transactions and balances, and a rehearsed incident plan. No single control is enough; safety comes from layers that catch what the previous layer missed.

What are blockchain security best practices?

Blockchain security best practices are the operating habits that keep a chain, a protocol or a dApp safe from build to live operation. They cover the code, the keys, the live system and the people who can change it, because a weakness in any one of those areas can undo the others.

The pattern is defence in depth. Each layer catches a different kind of failure, so a bug that slips past testing can still be stopped by monitoring, and a key that leaks can still be blocked by multisig. The table below shows the five areas that matter most.

Area What good looks like What it stops
Contracts Small, audited, tested on a testnet Logic bugs and exploits
Keys Multisig, hardware wallets, time delays Stolen or misused keys
Monitoring Alerts on large moves and odd calls Attacks that run for hours unnoticed
Upgrades Timelocked, tested, reversible where possible Bad upgrades and rushed fixes
Response Pause path, named owner, rehearsed plan Slow, confused incident handling

These practices apply whether you run a lending pool, a token, a bridge or a full chain. The details change with the product, but the order stays the same: secure the code, secure the keys, watch the system, and know what to do when something goes wrong. For the basics, see what blockchain security is.

How do you secure smart contracts before launch?

You secure smart contracts before launch by keeping them small, testing them hard, and having independent reviewers read the code before real funds arrive. Most losses trace back to a contract that was too large to reason about or was never reviewed by anyone outside the team that wrote it.

Start by shrinking the attack surface. Each contract should do one job, hold as little value as it can, and avoid clever shortcuts that are hard to audit. Pull shared logic into reviewed libraries instead of copying it between contracts.

Then test in layers:

  • Unit tests for every function, including the failure paths and edge cases such as zero amounts and empty lists.
  • Invariant tests that check rules that must always hold, such as total supply never changing without a mint.
  • Testnet runs with real users and real value at stake in play money, so integration bugs surface before mainnet.
  • External audit by a firm that did not write the code, with every finding fixed or written down as accepted risk.

An audit is not a guarantee. It is a review at one point in time, and contracts change after it. Treat the audit report as a list to work through, fix the findings, and re-check the changed code rather than filing the report away. Tooling helps here too, as blockchain security software covers.

How do you protect keys and admin access?

You protect keys and admin access by making sure no single person or device can move funds or change the system on its own. A single hot key is the most common way a protocol loses everything, so the goal is to spread control and add friction to dangerous actions.

Multisig is the standard starting point. A treasury that needs three of five named signers to approve a transfer cannot be drained by one compromised laptop. Keep the signers on separate devices and in separate places, and keep at least one signer offline in cold storage for the largest moves.

Time delays add a second safety net. When a sensitive action such as an upgrade or a large withdrawal is proposed, a timelock holds it for a day or two before it executes. That window lets the team and the community spot a malicious proposal and stop it before it takes effect.

Separate duties as well. The person who can deploy code should not be the person who can approve treasury moves, and neither should hold the keys alone. Write down who holds what, rotate keys when someone leaves, and test recovery of every key at least once a year. The same thinking applies to contract permissions, which smart contract security explains in more depth.

How do you keep a live protocol safe?

You keep a live protocol safe by watching it continuously and acting on what you see, because most attacks take minutes or hours, not seconds. Monitoring turns a silent drain into an incident you catch early, and early is usually the difference between a scare and a loss.

Watch the numbers that matter for your product: total value locked, large withdrawals, unusual call patterns, failed transactions, oracle prices and admin actions. Set thresholds that match normal behaviour, so an alert means something, and send alerts to a channel a human actually reads at all hours.

Give the team a way to stop the bleeding. A pause function that halts deposits and withdrawals, controlled by multisig, is the single most valuable emergency control a protocol can have. Test it on a testnet so the team knows how long it takes and what it breaks.

Run a bug bounty alongside monitoring. Paying a researcher for a real finding is far cheaper than paying an attacker for the same one, and a public bounty programme signals that you take reports seriously. Keep the scope and the rewards written down, and answer reports quickly so researchers keep coming back.

How do you handle upgrades and incidents?

You handle upgrades and incidents by deciding the process before you need it, because under pressure teams skip steps they would never skip on a calm day. A written runbook for upgrades and a rehearsed plan for incidents are both cheap to prepare and hard to improvise.

For upgrades, the sequence is: propose, review, test, wait, execute. Every change goes through the same code review and testing as a first launch, then sits in a timelock so the community can see it. After the upgrade, watch the same metrics as a launch for at least a day, and keep a rollback or pause path ready.

For incidents, name one owner who decides, one channel where updates go, and one rule for when to pause. The owner stops the loss first and investigates second. Keep a log of every action and decision, because a clear record is what lets you explain the incident afterwards and fix the real cause.

Afterwards, write the incident up honestly: what happened, what stopped it, and what changes. Publish what you can. Teams that share incident reports help the whole ecosystem, and users trust a protocol that explains its failures more than one that hides them. The gates that catch bad changes before they ship are the subject of smart contract security gates.

Example (hypothetical): a lending pool prepares for launch

Example (hypothetical): a small team is about to launch a lending pool that will hold user deposits and pay interest. The pool code is 800 lines across three contracts, and the team expects about 2,000 users in the first month.

The team starts with the contracts. It splits one large contract into three smaller ones, writes 120 unit tests and 15 invariant tests, and runs the pool on a testnet for three weeks with 40 testers. An external audit finds 9 issues: 2 high, 4 medium and 3 low. The team fixes all 9 and asks the auditor to re-check the two high findings.

For keys, the treasury uses a 3-of-5 multisig, with two signers on hardware wallets held offline and one signer in a different city. Upgrades go through a 48-hour timelock, and the team sets alerts for any withdrawal over $50,000 and any admin action.

The numbers show why the layers matter. A single missed bug could drain the whole pool, but the audit plus tests catch most bugs, the timelock stops a rushed bad upgrade, and the pause function limits a live attack to the minutes before someone notices. The launch is still not risk free, but each layer cuts the chance that one failure becomes a total loss.

What are the common mistakes?

The most common blockchain security mistakes are treating an audit as a finish line, keeping admin power in one key, and having no plan for the day something goes wrong.

  • Audit once, ship forever. Code changes after the audit are unaudited code. Re-check every change.
  • One key, one person. A single hot key for the treasury or upgrades is a single point of failure.
  • No pause path. Without a tested way to halt the protocol, an attack runs until the funds are gone.
  • Alerts nobody reads. Monitoring that pages no one is the same as no monitoring.
  • Copying code without review. Borrowed contracts carry borrowed bugs, and a famous name is not a security review.
  • No incident owner. When everyone can decide, nobody decides, and the response stalls.
  • Upgrades without a timelock. A change that executes instantly gives users no chance to react.

Key takeaways

  • Defence in depth: contracts, keys, monitoring, upgrades and response each catch different failures
  • Small audited contracts, tested on a testnet, are the cheapest security a protocol can buy
  • Multisig plus a timelock means no single person or key can move funds or change the system alone
  • Live monitoring with a tested pause path turns a silent drain into a caught incident
  • A rehearsed incident plan with one named owner beats improvising under pressure

Frequently asked questions

Is an audit enough to make a protocol safe?

No. An audit is a review at one point in time, and code changes afterwards are unaudited. Combine audits with small contracts, thorough tests, multisig keys, live monitoring and a pause path, and re-check every change that follows the audit.

How many multisig signers should a treasury have?

Three of five is a common starting point for a small team: it survives one lost key and one unavailable signer, while no single person can move funds alone. Larger treasuries often use more signers, with at least one held offline in cold storage.

What is a timelock and why does it matter?

A timelock holds a proposed change, such as an upgrade or a large withdrawal, for a set period before it executes. That window lets the team and the community spot a malicious or mistaken proposal and stop it before it takes effect.

How do bug bounties help blockchain security?

A bug bounty pays researchers to report real flaws before attackers find them, which is far cheaper than losing funds. A written scope, clear rewards and fast replies keep researchers engaged and turn the community into an extra review layer.

What should monitoring watch for?

Watch total value locked, large withdrawals, unusual call patterns, failed transactions, oracle prices and admin actions. Set thresholds that match normal behaviour so alerts mean something, and route them to a channel a human reads at all hours.

Should a protocol have a pause function?

Yes, if it holds user funds. A pause that halts deposits and withdrawals, controlled by multisig, is the fastest way to limit damage during an attack. Test it on a testnet so the team knows how long it takes and what it breaks.

Found this useful? Share it.
Hertiv engineering team

Written from projects we build for clients: blockchain systems in production. Every post is reviewed by a senior engineer before publishing and updated when practice changes.

About HertivHow we work

Building a protocol and want the security layers done properly? Talk to Hertiv.

A senior engineer replies within one business day. Or see our Smart Contract Audit service.

Book a free call

Keep reading

All posts

Tell us what you want to build

A senior engineer reads every request and replies within one business day with questions, a rough range, or a call link.

  • NDA on request before any details
  • You own all code, models and IP
  • US, UK and EU time-zone overlap

Your email app should open with your message ready to send. If it does not, write to [email protected].

Prefer email? Write to [email protected]
Estimate costBook a call