Skip to content

Monero signature verification example - pure Python

Notifications You must be signed in to change notification settings

ymgve/monero_signatures

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Monero signature verification example - pure Python

While there are lots of sites describing Monero's ring signatures at a high level, I had a hard time finding any that had actual code examples, down to the gritty details. The closest thing is the main client code, which is a bit unclear and sometimes hard to follow.

This code is pure Python and hopefully easier to follow - it shows how the signature in the first non-Coinbase transaction of Monero is verified. Note that is is a version 1 transaction, before RingCT, before Bulletproof, just a pure ring signature.

The Cryptonote 2.0 whitepaper explains most of the details that goes into ring signature verification, but there are a few vital details missing. First, the function Hp which takes an elliptic curve point, hashes it, and generates another elliptic curve point, is not defined. It turnes out that this function is implemented as ge_fromfe_frombytes_vartime in the reference client, and isn't really documented. Thankfully, there also exists a Python implementation in the Mininero project, as the function hashToPointCN.

Secondly, the definition of the final signature hash differs between the paper and the client - while the paper describes it as H(m, L0, L1, ..., R0, R1, ...) it's actually implemented in the code as H(m, L0, R0, L1, R1, ...) - it's unclear why this was changed, as the cryptographic strength should be the same.

About

Monero signature verification example - pure Python

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages