Iraklis
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights New
    • Engagement control
    • Make a copy
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Make a copy Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       Owned this note    Owned this note      
    Published Linked with GitHub
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    [TOC] # The Role of Signatures in Digital Assets and Cryptocurrencies. If you are reading that article there is a good chance that communication between your browser and the endpoint serving the content is confidential and authenticated using core cryptographic primitives. The level of abstraction is so high that even if you probably have never heard what encryption, signatures, message authentication code is; the job is done: you are browsing end to end securely: external parties cannot read the exchanged content or change content without being detected. In this article we will focus on unwrapping the internals of digital signatures and the role they play in digital assets and cryptocurrencies. ## Traditional Signatures A bank cheque is an order for money transfer from a sender to a receiver - being validated from a bank issuing the cheques. The cheque issuer called the drawer specifies on the cheque the payee to whom the money will be transferred and the amount thereof. The entire procedure is being validated with the hand signature of a drawer on the cheque paper. In an ideal world nothing can go wrong. The receiver of the cheque goes to the bank, the bank validates and proceeds with the money transfer. However, the problem that arises with hand-written signatures is that in a real world the signature is not unique per cheque paper, but instead it is always the same. That allows easy forging of a cheque signature. You wouldn't be very happy if someone tweaks your cheque and add one more 0 at the transferable amount when you act as a drawer. ![](https://i.imgur.com/YX6WHEJ.png =500x200) ## Digital Signatures Digital signatures solve the aforementioned problem by binding the message that needs to be signed with the signature itself. Every electronic signature issued for a message is a different bytestream. In contrast, in traditional signatures the object itself is the same handwritten signature for all messages for the same sender. In order someone to forge the electronic signature by changing the signed message it has to break a mathematical hard problem which with the current known infrastructure and knowledge is almost impossible. The sender specifies its public and secret signing key, makes the public key publicly available and keeps secret its secret signing key. ![](https://i.imgur.com/Q9wsgyy.png =450x250) The signer gives as input to the signature algorithm the message to be signed and the secret signing key. The receiver validates the correctness of the signature with the public verification key, which usually comes in the form of a certificate which binds senders public information with its public key. The binding is a signature from a Certificate Authority on the public key of the sender with its publicly identifiable metadata. In a real infrastructure the security of the protocol does not only rely on the security guarantees of the signature, its secure implementation, secure storage of the secret key and trustworthy communication channels but also and on the security of the CA it self as well. Hacking the CA and issuing malformed certificates can have devastating consequences as attackers can perform man in the middle attacks and impersonating involved parties. > CAs have been hacked multiple times. Some notable examples include [Diginotar](https://slate.com/technology/2016/12/how-the-2011-hack-of-diginotar-changed-the-internets-infrastructure.html), [Comodo](https://www.infoworld.com/article/2623829/weaknesses-in-ssl-certification-exposed-by-comodo-security-breach.html) and [MonPass](https://thehackernews.com/2021/07/mongolian-certificate-authority-hacked.html) ## Signatures in Digital Assets With the advent of distributed ledger technologies and the financial application built on top (i.e: cryptocurrencies) the interest in digital signatures skyrocketed. Digital signatures are the core primitive in a digital asset system, which guarantees ownership of digital assets and prevents double spending: spend more that you actually own. In a cryptocurrency system when Steve wants to send a specific amount of digital asset (e.g: bitcoin) to Laura then Steve signs a bytestream containing a spending input on his own account. Then the miners/validators with publicly available information verify the validity of the signature and according to the underlying consensus mechanism finalize the transaction by adding it as a block on the master distributed ledger. Flaws in a digital signature can have devastating consequences on the fairness and the security of the system. Due to a possible non-secure secret signing key storage, or a potential flaw on the underlying signing algorithm an adversary can initiate unauthorized transactions, which may never revert back. Three signatures are governing the DLT ecosystem: ECDSA, Schnorr and EdDSA. All those signatures schemes rely on Elliptic curve groups and on mathematical hard underlying problems. Different curves provide different efficiency and security guarantees in general. For example Edward curves are considered as more secure as it is easier to implement them in constant time to avoid side channel attacks due to their generic forms without special cases. In the rest of the article we will treat the underlying elliptic curve operations and groups as a black box and we will highlight only algebraic equations on top of them. For all described bellow signagures there exists an underlying group $\mathbb{G}$ of prime order $q$ where the arithmetic operations are performed. All operations are $\mod q$ and there exists a hash function $H\{0,1\}^*\rightarrow \mathbb{Z}_q$ ### ECDSA Signature When Bitcoin network went live Mr Nakamoto decided the underlying signature scheme to be [ECDSA](https://www.cs.miami.edu/home/burt/learning/Csc609.142/ecdsa-cert.pdf). The first step at the Sign algorithm is crucial. For each signature a secure implementation should sample a new fresh random $k$. If that is not the case then an adversary seeing two different signatures for different messages can extract the secret signing key ([PS3 hack](https://arstechnica.com/gaming/2010/12/ps3-hacked-through-poor-implementation-of-cryptography/)). And if repeating randomness sounds an extreme scenario, only repetition of some bits from $k$, is enough to [extract](https://eprint.iacr.org/2019/023.pdf) [the](https://eprint.iacr.org/2020/615.pdf) [remaining randomness](https://minerva.crocs.fi.muni.cz/) with good probabilities. Another negative point of the signature is that it is not easily compatible with blockchain desired signature byproducts, i.e: multi-signatures, aggregate signatures and MPC protocols. The reason is the non-linear equation to compute the $s$ part of the signature due to the inverse element $k^{-1}$. Last but not least ECDSA is malleable by definition: two different signatures can map to the same message. That is possible because $(r,s)$ and $(r,-s\mod q)$ are successfully validated for a message m. That can be mitigated with an [implementation](https://github.com/bitcoin-core/secp256k1/blob/74c34e727bd68d8665e15446e50731006f178aa0/src/ecdsa_impl.h#L304) restriction on the form of $s$ (consider always the smaller $s$). :::danger * Setup(): Output an elliptic curve group $\mathbb{G}$ of order $q$ and an element G which generates $\mathbb{G}$. * KeyGen($1^{\lambda}$): Choose uniformly at random $x\gets \mathbb{Z}_q$. The secret key is $x$ and the public key $\mathsf{pk} = G \cdot x$ * Sign(m,$x$)-> $\sigma$: * Pick uniform at random $k\gets \mathbb{Z}_q$ * Compute $R = k \cdot G$ * Let $R=(r_x,r_y)$ * Set $r = r_x$ * s = $k^{-1}(H(m) + x\cdot r)$ * Output $\sigma = (r,s)$, if $r=0$ or $s=0$ repeat the above steps. * Verify($\sigma,\mathsf{pk}$): * Compute $a=H(m)/s =$ and $b=r/s$ * $u = G \cdot a + G \cdot b$ * Let $u=(u_x,u_y)$ * $r' = u_x$ * if $r==r'$ accept, otherwise reject ::: ### Schnorr Signature [Schnorr](https://d-nb.info/1156214580/34) signature scheme, which by the time Bitcoin started, it was patented; overcomes some of the downpoints of ECDSA. It has a linear form which makes it easier to implement MPC versions thereof but also aggregation and multisignatures come with less efforts. It is not malleable and has stronger theoretical security proof analysis compared with ECDSA. However the need for new randomness is still present, which renders it vulnerable to implementation bugs. :::success * Setup(): Output an elliptic curve group $\mathbb{G}$ of prime order $q$ and an element G which generates $\mathbb{G}$. * KeyGen($1^{\lambda}$): Choose uniformly at random $x\gets \mathbb{Z}_q$. The secret key is $x$ and the public key $\mathsf{pk} = G \cdot x$ * Sign(m,x)-> $\sigma$: * Pick uniform at random $k\gets \mathbb{Z}_q$ * Compute $R = k \cdot G$ * Let $R=(r_x,r_y)$ * Set $r = r_x$ * s = $k+H(r||\mathsf{pk}||m) \cdot x$ * Output $\sigma = (r,s)$ * Verify($\sigma,\mathsf{pk}$): * if $s\cdot G==R+H(r||\mathsf{pk}||m)\cdot \mathsf{pk}$ accept, otherwise reject ::: ### EdDSA Signature EdDSA removes the need for new randomness for every message. As described below the Sign algorithm--which omits many details--fetches the randomness deterministically from the secret key and the message. Moreover, EdDSA is implemented on Edward curves as Curve25519 and Curve448 which make them easily constant time if implementation is correct and provide more [efficient algebra](http://ed25519.cr.yp.to/) implementation. :::info * Setup(): Output an elliptic curve group $\mathbb{G}$ of prime order $q$ and an element G which generates $\mathbb{G}$. * KeyGen($1^{\lambda}$): Choose uniformly at random $x\gets \mathbb{Z}_q$. The secret key is $x$ and the public key $\mathsf{pk} = G \cdot x$ * Sign(m,$x$)-> $\sigma$: * Compute $r = H(H(sk)+m)$ * Let $R=(r_x,r_y)$ * Compute $h = H(R||\mathsf{pk}||m)$ * s = $r+h\cdot\mathsf{sk}$ * Output $\sigma = (r,s)$, if $r=0$ or $s=0$ repeat the above steps. * Verify($\sigma,\mathsf{pk}$): * Compute $h = H(R||\mathsf{pk}||m)$ * $P_1 = s\cdot G$ * $P_2 = R+h\cdot\mathsf{pk}$ * if $P_1==P_2$ accept, otherwise reject ::: ## Conclusion Cryptography research is growing along with the blockchain ecosystem with prominent primitives being designed, implemented and deployed: Threshold cryptography, zero-knowledge proofs, aggregate signatures, VDF, VRF, distributed random beacons, etc. The amount of work that has been put forth both from research and engineering into digital signatures is exponentially growing the last years. We are witnessing a minimum time gap from protocol description to a POC implementation and production ready cryptographic code. We will see new signatures substituting the aforementioned; being faster, more secure and easier to implement. Every single step from protocol description to POC to production needs to be reviewed thoroughly as a flaw can cost. Industry will push always to early adoption but cryptographic primitives to become standards will need years. Cryptographic protocols are in the heart of every digital financial system securing digital assets and the best choice will always have trade-offs. A cryptographic protocol does not stand at its own in a production environment. An isolated security analysis thereof is only the first step. Product owners, engineers, QA and devops need to orchestrate with cryptographers to understand the risks of deploying cryptographic code and secure the entire infrastructure from potential malevolent users. At Parfin we take all the required steps to deploy production ready cryptographic protocols for financial institutions.

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully