Return-Path: Received: from smtp3.osuosl.org (smtp3.osuosl.org [IPv6:2605:bc80:3010::136]) by lists.linuxfoundation.org (Postfix) with ESMTP id 98C50C002D for ; Sat, 5 Nov 2022 08:46:30 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 66BDA6119B for ; Sat, 5 Nov 2022 08:46:30 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 66BDA6119B Authentication-Results: smtp3.osuosl.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=Wcd+N5Nv X-Virus-Scanned: amavisd-new at osuosl.org X-Spam-Flag: NO X-Spam-Score: -0.848 X-Spam-Level: X-Spam-Status: No, score=-0.848 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, BITCOIN_OBFU_SUBJ=1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001] autolearn=no autolearn_force=no Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id vFa5EiJtABrr for ; Sat, 5 Nov 2022 08:46:29 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.8.0 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 87A5760AC2 Received: from mail-ed1-x52c.google.com (mail-ed1-x52c.google.com [IPv6:2a00:1450:4864:20::52c]) by smtp3.osuosl.org (Postfix) with ESMTPS id 87A5760AC2 for ; Sat, 5 Nov 2022 08:46:29 +0000 (UTC) Received: by mail-ed1-x52c.google.com with SMTP id a5so10636213edb.11 for ; Sat, 05 Nov 2022 01:46:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=stqyjavhu0eX+4uUUNZfR3f8DJVm5LqgmeJb/vXEpgY=; b=Wcd+N5NvS3iYxD9QXHIzeAU65X95D262PA0BWkc2gE7/rNGzdzWZ5kGkhJqsmwq0Ss L2yyBeYUIccG8k2brN+B7/Vh7bXr73yFxrdQeiqFlXpG0EgYGxE4/jOhnW1Sw5uK0kJ1 ZAM3XqPpRrYyD0mQUyGiFzsQDgrdrgi1ihYSvgZOamrC70ZbqSJHkX4AsOJSgG7agzZQ GFDA/gabjbjzXOmzQ/xVLYp8M/PjLs7DgmHO3VL+z8BFnZ8tT3ZfVy8+6zHxkphJwxb5 n1iMPH78WmvNLHHYqn+7gmO06aE8pIAa0QNs9mLN7Ur1pNgFWWd5Kig3B2PmcXAYt4P2 5QJQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=stqyjavhu0eX+4uUUNZfR3f8DJVm5LqgmeJb/vXEpgY=; b=3VwjyR2XZtiESaRWkdP73w8Gnks+vjDrI05TJXd5TfluErh6hZ9QPZEND7rP9fGqHU MY+yyMQiUa2/Y6NRYs9SmBdgVOaqhmyWyDWK4/QM+wySsAqkEUKXQDwhEltv1gmhwPqm z8f+Y4THproTfIQMh5iYsynTHKhGtA3fLQRogjC+lTocF6gH2W7rtDdtJYoTaI6WvXuG XtHxLQFgnHng0XgsYsVbAzaEKbadf3QAvE2nG79ZUiiINazDZXTVFCu5EN8WCETzun/T zSw2dKYpodSOcCVcjabxzaILScXJpePerVApnObjHIJyPaymtP7cSkzYQLwNS57Uuzmn chVw== X-Gm-Message-State: ACrzQf2KVewLRBImBe3m/iCOpb6B8P6UApeBXMoM7w6F+w1RUuPnc9Cs kxZ5NDlasxhqETeoICKy1GC9W//1UydLfBYhkDSWV/oHn+4= X-Google-Smtp-Source: AMsMyM6u+npbUFj1zuoLf+Uq5htTxySe5JVkgiMLmXliWwtBbLHi4DjboP+7+KPzLeq9bmt0RbQpQJgKyhyB085mR7I= X-Received: by 2002:aa7:da03:0:b0:461:4fc2:3e0f with SMTP id r3-20020aa7da03000000b004614fc23e0fmr39084531eds.321.1667637987305; Sat, 05 Nov 2022 01:46:27 -0700 (PDT) MIME-Version: 1.0 From: MC 5760 Date: Sat, 5 Nov 2022 15:46:15 +0700 Message-ID: To: bitcoin-dev@lists.linuxfoundation.org Content-Type: multipart/alternative; boundary="000000000000d8f01605ecb539df" X-Mailman-Approved-At: Sat, 05 Nov 2022 14:26:39 +0000 Subject: [bitcoin-dev] Generate and verify ECDSA signature without "r" X-BeenThere: bitcoin-dev@lists.linuxfoundation.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Bitcoin Protocol Discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Nov 2022 08:46:30 -0000 --000000000000d8f01605ecb539df Content-Type: text/plain; charset="UTF-8" 1. Address: private key -> ECC -> public key compression -> Bech32m encode 2. scriptPubkey: Address -> Bech32m decode -> public key compression 3. Segwit: (dsha256(txid_input & index) * x public key + dsha256(unsigned raw transaction) mod (private key)) mod (N) => Will give a number of 32 bytes 4. Verify: x1, y1 = ECC(G, dsha256(txid_input & index)) p1 = ECC(G, dsha256(unsigned raw transaction) mod (Segwit)) p2 = ECC((x1,y1) * x public key mod (Segwit) x2, y2 = ECAddpoint(p1, p2) If x2 = x public key => OK I wrote the python code here: https://github.com/tanvovan/bitcoin/blob/main/p2pc.py --000000000000d8f01605ecb539df Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

1. Address: private key -> ECC -> public key compression -> Bech32m encode

2. scriptPubkey: Address -> Bech32m decode -> public key compression

3. Segwit: (dsha256(txid_input & index) * x public key + dsha256(unsigned = raw transaction) mod (private key)) mod (N) =3D> Will give a number of 32 by= tes

4. Verify:

x1, y1 =3D ECC(G, dsha256(txid_input & index))

p1 =3D ECC(G, dsha256(unsigned raw transaction) mod (Segwit))

p2 =3D ECC((x1,y1) * x public key mod (Segwit)

x2, y2 =3D ECAddpoint(p1, p2)

If x2 =3D x public key =3D> OK

I wrote the python code here: https://gith= ub.com/tanvovan/bitcoin/blob/main/p2pc.py

--000000000000d8f01605ecb539df--