Smart Contract Fingerprinting: A Method for Pattern Recognition and Analysis in Bitcoin Cash

I published this on my Gitlab repo (click link to see full doc.):

Smart Contract Fingerprinting: A Method for Pattern Recognition and Analysis in Bitcoin Cash

Abstract. We present a novel method for analyzing and categorizing smart contracts on the Bitcoin Cash blockchain through Script bytecode fingerprinting.
Unlike traditional blockchain analysis that treats each unique bytecode as a distinct entity, our approach separates the executable logic from embedded data elements, enabling identification and grouping of functionally equivalent contracts.
By transforming sequences of data push operations into normalized count indicators, and applying a hash function to the resulting pattern, we create unique fingerprints that identify contract types regardless of their specific parameter values.
This method facilitates efficient contract classification, analysis, and discovery, while maintaining the ability to reconstruct and filter individual contract instances based on their parameters.

Keywords: Blockchain · Bitcoin Cash · Bitcoin Script · Chainanalysis.

2 Likes

WIP implementation in BCHN: Commits · bcpattern · ac-0353f40e / Bitcoin Cash Node · GitLab

Example pattern object output for some M-of-3 multisig:

image

2 Likes

Wasn’t immediately obvious to me but the approach makes total sense. :smiley:

If I explain in CashScript terms: we want to recognize the different Artifacts on-chain even though they use different constructor arguments at creation and hence result in different smart contract addresses.

Contracts of the same type all have the same op_code logic and only differ in these ‘data elements’ so by replacing the variable data elements into count indicators, we are left with the same info that is also encoded in the Artifact.

This way it becomes easy to detect for example all AnyHedge or Cauldron contracts on-chain.
However, with P2SH we can only detect these contract fingerprints when the UTXO is spent and the full script is provided, so it’s a trailing indicator.

1 Like