On-chain risk management