Cointime

Download App
iOS & Android

The Bluffers Guide to secp256k1 ... When Satoshi Said Goodbye to PKI

Validated Individual Expert

If it wasn’t for Satoshi Nakamoto, you probably would never have heard of the secp256k1 Elliptic Curve Cryptography (ECC) method. But, Satoshi used it to take a private key and then produce a public identifier.

At the core of the adoption of Bitcoin is the usage of the ECDSA (Elliptic Curve Digital Signature Algorithm), and where it was possible to verify a transaction from the public Bitcoin identifier. The standard for secp256k1 is published [here]:

This is a Weierstrass form of elliptic curve, and uses:

y²=x³+7 (mod p)

It has a base point of g=(0x79be667ef9dcb … 959f2815b16f81798, 0x483ada77 … 8ffb10d4b8) and a prime number of ²²⁵⁶−²³²−²⁹−²⁸−²⁷−²⁶−²⁴−1. The order of the curve is n=0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141.

Overall we have a private key of a and then produce a public key of aG. We do this though point addition. For secp256k1, we have a 256-bit private key value, and a 512-bit public key value (and which is a point on the elliptic curve).

Why secp and not NIST?

Who knows why Satoshi chose the secp256k1 curve over the NIST defined curve of secp256k1. Many have questioned the close relationship between NIST and the NSA, and the possiblity of inserting a backdoor in the curve. And, so, perhaps Satoshi went for secp256k1 for this reason.

Points on secp256k1

The points on an elliptic curve curve do not always give a valid x-co-ordinate. Also there are two points for every valid x-co-ordinate value:

  • Elliptic Curve points for common curves in an x-range. Elliptic Curve points. This example uses Curve 25519, secp256k1, P256 and P512 to show the range of points for a given x-coordinate range.
  • First 20 Elliptic Curve points in Finite Field for common curves. Elliptic Curve points. Locating the first 20 points in an elliptic curve in a finite field for curves including Curve25519 (Tor), secp256k1 (Bitcoin) and NIST P-256.

Montgomery Ladder with secp256k1

The thing that makes elliptic curve cryptography fast, is the ability to multiply a point (G) by a scalar value (normally, the private key) to give a.G. This is fast due to the Montgomery ladder:

  • Montgomery Ladder in calculating kG in a fixed time. Ladder. Calculates kG for secp256k1.

Charting

An elliptic curve is beautiful in its analogue from, but points when discrete:

  • Draw y²=x³+7(mod p) [here].

Point multiplication

At the core of elliptic curve cryptography, we perform point multiplication:

  • Real ECC curves for (1G, 2G and nG). Elliptic Curve real. Curve 25519, secp256k, and so on.
  • Inverse of private key for secp256k1 with Python. Inverse of private key secp256k1. In this example Alice sends aG and Bob sends back abG. Alice then calculates a−1(mod n) and can then determine a^{−1}abG=bG. The secp256k1 curve is in the Weierstrass curve form (y²=x³+ax+b).

Key generation

Basically elliptic curve cryptography focuses on the digital signing process, and where we generate a private key (sk) and a public key (pk). There are defined as a key pair:

  • Elliptic Curve (OpenSSL Key Generator). Elliptic Curve (Keys). Elliptic Curv is a public key method. This page outline the generation of ECC key, including secp128r1.
  • Elliptic Curve (Keys). Elliptic Curve (Keys). Elliptic Curv is a public key method. This page outline the generation of ECC keys in Bitcoin.

ECDH with secp256k1

Along with digital signatures, elliptic curve methods are used in key exchange:

  • Elliptic Curve Diffie-Hellman (ECDH) with secp256k1. ECDH. Elliptic Curve Diffie Hellman is used to create a shared key.
  • Elliptic Curve Diffie-Hellman (ECDH) with different curves. ECDH. Elliptic Curve Diffie Hellman is used to create a shared key using different curves, including secp256k1, p192 and p224.
  • secp256k1 ECDH with Python. secp256k1 ECDH. Elliptic Curve Diffie Hellman using secp256k1 with Python. The secp256k1 curve is in the Weierstrass curve form (y²=x³+ax+b).
  • Authenticated secp256k1 ECDH with Python. Authenticated secp256k1 ECDH. Elliptic Curve Diffie Hellman using secp256k1 with Python, and where we use a long-term key for Bob and Alice to create a shared session key. The secp256k1 curve is in the Weierstrass curve form (y²=x³+ax+b).

ECDSA

A core part of the trust on the Bitcoin and Ethereum is the usage of the ECDSA signature:

  • Elliptic Curve Digital Signature Algorithm (ECDSA). ECDSA. Elliptic Curve Digital Signature Algorithm (ECDSA) is used to sign data.
  • Elliptic Curve Digital Signature Algorithm (ECDSA) with core operations. ECDSA. Elliptic Curve Digital Signature Algorithm (ECDSA) is used to sign data with core operations.

But it needs to be treating with caution:

  • Crack ECDSA from leak of nonce (SECP256k1). ECDSA with nonce. This outlines ECDSA how the private key can be recovered with a leak of the nonce value for SECP256k1.
  • Crack ECDSA with weak nonces. ECDSA with weak nonces. This outlines ECDSA how the private key can be recovered with weak nonce values.
  • Blinded ECDSA. Blinded ECDSA. With a blinded signature, Bob can sign for a message, without knowning what the message is. In this case Alice will create a blinded ECDSA signature, and where Bob can then sign it, and then Alice can unblind it. The method is based on one produced by Oleg Andreev for blinding signatures in Bitcoin.
  • ECDSA: Fault Attack. ECDSA: Fault Attack. In the fault attack in ECDSA we only require two signatures. One is produced without a fault (r,s) , and the other has a fault (rf,sf)

What’s the size of the public key?

As the public key is a point, in its purest form we have a 512 bit public key, and which is made up of 256 bits for the x-coordinate and 256 bits for the y-coordinate. But, we can also compress this, as we can easily derive the y-coordinate from the x-coordinate. In the end, there are only two possible y-coordinates, so all we have to do, is record whether it is odd or even and compress the point with just an identifier and the x-coodinate:

Conclusions

Comments

All Comments

Recommended for you

  • Singapore-based Uxuy raises $7M in Pre-A funding for decentralized multi-chain trading platform.

    Singapore-based decentralized multi-chain trading platform, Uxuy, has secured $7M in Pre-A funding from a range of investors including Binance Labs, Matrix Partners, and GBV Capital. The funds will be used to facilitate low-cost transactions of various assets across different blockchain networks. Uxuy, which is incubated by Binance Labs, aims to provide users with a seamless trading experience.

  • Bitcoin native application platform Arch developer completes $7 million seed round of financing, led by Multicoin Capital

    Bitcoin native application platform Arch developer Arch Labs announced the completion of a $7 million seed round of financing, led by Multicoin Capital, with participation from Portal Ventures, OKX Ventures, Big Brain Holdings, CMS Holdings and Tangent.

  • Tokenization platform AgriDex completes $5 million Pre-Seed round of financing

    AgriDex, a tokenization platform on the Solana blockchain, announced the completion of a $5 million Pre-Seed round of financing, led by Endeavor Ventures, with participation from African Crops Limited, Oldenburg Vineyards, and former Goldman Sachs and Citadel executive, Hank Oberoi. It is reported that AgriDex is expected to launch its platform and token, AGRI, in the third quarter of this year. According to its white paper, AgriDex has reserved 5% of the total token supply, or 50 million tokens out of 1 billion tokens, for airdrops.

  • UXUY Completes $7 Million Pre-A Round of Financing, with Investments from Binance Labs, Bitcoin Magazine, and Other Institutions

    UXUY, the next-generation decentralized multi-chain trading platform incubated by Binance Labs, announced the completion of a $7 million Pre-A round of financing. Since its establishment, its total financing amount has exceeded $10 million. UXUY is an important builder of the Bitcoin ecosystem, and more than 100,000 traders use Bitcoin Lightning Network services through UXUY. UXUY's current round of financing has received investment from well-known institutions in Asia, North America, and Europe, such as Binance Labs, UTXO Management (Bitcoin Magazine), JDI Ventures, Bixin Ventures, SWC Global, Matrix Partners, CMS Holdings, Dewhales Capital, Comma3 Ventures, Satoshi Labs, YBB Capital, GBV Capital, Web3Vision, Pentos Ventures, NGC Ventures, Alti5, Metalpha, and GSR. The funds raised by UXUY in this round will be used for the construction of the Bitcoin ecosystem infrastructure, and will be committed to promoting the efficient and low-cost trading of Lightning Network Taproot Assets, Ordinals BRC-20, Runes, and other assets. Jordan, co-founder of UXUY, said: "We are pleased to be strategic partners with all investors! This year, we have successfully built a bridge between the Bitcoin Lightning Network and the multi-chain ecosystem. UXUY will continue to promote the use cases and popularization of the Lightning Network in trading scenarios, and make more contributions to the Bitcoin ecosystem." According to RootData, a Web3 asset data platform, UXUY is a next-generation decentralized multi-chain trading platform based on MPC wallets. UXUY actively participates in the construction of the Bitcoin Layer2 ecosystem, fully integrates into the Bitcoin Lightning Network and Taproot ecosystem, provides Lightning Address DID services to users, and becomes an important bridge connecting the Bitcoin and Ethereum ecosystems. As a decentralized multi-chain trading platform, UXUY provides immediate cross-chain trading services for Coin, Token, and Inscription among public chains through the establishment of uPool.

  • Taiwan's administrative agency passed four new anti-fraud laws to bring cryptocurrency traders under control

    It was announced that Taiwan's administrative management agency has passed the "New Anti-Fraud Law" to regulate cryptocurrency traders. In the future, businesses or individuals providing virtual asset services or third-party payment services must complete anti-money laundering measures and register their services or log in. Failure to do so may result in a maximum of 2 years in prison or a fine of up to NT$5 million. Businesses or individuals outside of Taiwan providing virtual asset or third-party payment services must register their companies or branches according to company law and complete anti-money laundering measures and service registration or login. Otherwise, they are not allowed to provide virtual asset services or third-party payment services in Taiwan. Qiu Shuzhen, the deputy chairman of Taiwan's financial regulatory agency, stated that there are currently around 60 to 70 cryptocurrency traders in the market, of which 25 have passed the anti-money laundering review by the financial regulatory agency. In the future, all traders will be required to declare and undergo review, and a cryptocurrency traders' association will be established for legal, administrative, and association management. Accounting professionals will also be enlisted to assist with internal control.

  • EigenLayer TVL falls back to $14.794 billion

    According to DefiLlama data, the total value locked (TVL) in Ethereum's re-staking protocol EigenLayer has fallen below $15 billion, currently at $14.794 billion.

  • The EU is considering including cryptocurrencies in the 12 trillion euro investment market, and its impact may far exceed that of US ETFs

    The European Securities and Markets Authority (ESMA) is consulting with the investment product advisory industry and experts on whether cryptocurrency assets should be included. This move could open up a broader market for cryptocurrencies, far exceeding the market size of spot Bitcoin ETFs. The plan aims to expand the scope of UCITS (EU Transferable Securities Collective Investment Scheme), with the UCITS market reaching as high as €12 trillion. If successful, this would be a key step in mainstreaming cryptocurrency assets in Europe.

  • SlowMist: The hacker who stole 1,155 WBTC may be from Hong Kong

    According to SlowMist analysis , the IP address associated with the theft of 1155 WBTC has been traced to Hong Kong (VPN use cannot be ruled out). Earlier reports indicated that a certain address was suspected to be a victim of phishing attacks and lost 1155 WBTC, worth 71 million USD. Subsequently, the fraudsters sold all 1155 WBTC and exchanged them for 22960 ETH, and used a large number of wallet addresses to send and launder the funds.

  • Web3 game developer Seeds Labs completes $12 million seed round of financing, with participation from Solana Foundation and others

    According to Cointelegraph, Web3 game developer Seeds Labs has announced the completion of a $12 million seed round financing, with participation from Avalanche's Blizzard Fund, Solana Foundation, Krust, Hashkey Capital, UOB Ventures, Signum Capital, IVC, and Emoote.It is reported that Seeds Labs, a Solana ecosystem game infrastructure developer, was established in 2021, and its Web3 game Bladerite is scheduled to be released this month.

  • The total subscription volume of Hong Kong Bitcoin ETF yesterday was 101.6, and the Ethereum ETF showed net redemption for two consecutive days

    The Hong Kong Bitcoin spot ETF had a net purchase of 101.6 bitcoins and a total holding of 4350 bitcoins on May 8th. The daily trading volume was 2.67 million US dollars, and the total net assets were 270 million US dollars. The daily BTC purchase came from Bosera HashKey and Huaxia Bitcoin ETF.