简体   繁体   English

可以使用比特币地址来验证使用给定私钥进行的签名吗?

[英]Can a Bitcoin address be used to verify a signature made with a given private key?

Problem: I have a Bitcoin address, ie 1EHNa6Q4Jz2uvNExL497mE43ikXhwF6kZm.问题:我有一个比特币地址,即 1EHNa6Q4Jz2uvNExL497mE43ikXhwF6kZm。 And I have a list of private keys which I am not sure where this address was derived from.我有一个私钥列表,我不确定这个地址是从哪里派生出来的。 I want to find out which of these private keys has derived that address (through public key).我想找出这些私钥中的哪一个导出了该地址(通过公钥)。 For the address above, the private key is 1 (00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01).对于上面的地址,私钥是 1 (00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0 0 0)。

Per my understanding, there are different ways of deriving public keys from a private key (ECDSA being the most common, but also HD/BIP 32 | https://en.bitcoin.it/wiki/Private_key ).根据我的理解,有多种从私钥派生公钥的方法(ECDSA 是最常见的,但也是 HD/BIP 32 | https://en.bitcoin.it/wiki/Private_key )。 And then, from the public key, a BTC address can be generated (via multiple hashings and other operations | https://en.bitcoin.it/wiki/Address ), which makes it impossible to find the public key from a Bitcoin address.然后,根据公钥,可以生成一个 BTC 地址(通过多次散列和其他操作 | https://en.bitcoin.it/wiki/Address ),这使得无法从比特币地址中找到公钥.

If my assumptions above are correct, my question is: is it still possible to validate the relation between a private key and a Bitcoin address?如果我的上述假设是正确的,我的问题是:是否仍然可以验证私钥和比特币地址之间的关系?

I wanted to sign a message with the private key and use a public key to validate that.我想用私钥签署一条消息并使用公钥来验证它。 Since I don't have the public key, I would have to derive one from the private key and then generate a Bitcoin address to compare with the one I have.由于我没有公钥,我必须从私钥中推导出一个,然后生成一个比特币地址来与我拥有的地址进行比较。 But, then, what if the address was generated with the HD/BIP 32 method?但是,如果地址是使用 HD/BIP 32 方法生成的呢?

PS: I am using BouncyCastle and NBitcoin libs to run the tests. PS:我使用 BouncyCastle 和 NBitcoin 库来运行测试。

If you are using Bitcoin Core and you want to know the Private Key that belongs to one of your addresses, go to Console or use RPC and call dumpprivkey "myaddress" .如果您正在使用 Bitcoin Core 并且想知道属于您的地址之一的私钥,请转到控制台或使用 RPC 并调用dumpprivkey "myaddress"

And throw the Private Key on WIF format.并以 WIF 格式抛出私钥。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM