Go-Ethereum

生成公鑰

  • January 22, 2020

我使用命令:

> eth.getTransaction("0xac844bd1107761fec3abe2f55bf739f0e7cc6dd1cd169a60176bfb22
9826b5a8")

其中括號包含成功交易的雜湊值。這就是我得到的:

{
 blockNumber: null,
 from: "0xcf03e41ee1116bed4f1acf8a2209b4d37d755988",
 gas: 90000,
 gasPrice: 18000000000,
 hash: "0xac844bd1107761fec3abe2f55bf739f0e7cc6dd1cd169a60176bfb229826b5a8",
 input: "0x165c4a16000000000000000000000000000000000000000000000000000000000000
00050000000000000000000000000000000000000000000000000000000000000006",
 nonce: 28,
 r: "0x4f674ff118c840d032fb3cba8ba0f9cdaed1f73be54f08b487fe1204b5bab809",
 s: "0x736f214a50ad1b417380e2c0aee273459f78fac0bd37deb59b4e7c112736acee",
 to: "0x2608273b77ef3964ceb1fb488d4b95b30258d091",
 transactionIndex: 0,
 v: "0xf09",
 value: 0
}

我可以使用上述任何值來生成我的交易的公鑰嗎?

是的,當然,您可以使用ABDK Toolkit從您的交易中恢復公鑰。為此,您需要原始十六進制格式的交易。您可以再次使用ABDK Toolkit將交易轉換為這種格式。

您的原始格式的特定交易如下所示:

0xf8ac1c850430e2340083015f90942608273b77ef3964ceb1fb488d4b95b30258
 d09180b844165c4a160000000000000000000000000000000000000000000000
 0000000000000000050000000000000000000000000000000000000000000000
 000000000000000006820f09a04f674ff118c840d032fb3cba8ba0f9cdaed1f7
 3be54f08b487fe1204b5bab809a0736f214a50ad1b417380e2c0aee273459f78
 fac0bd37deb59b4e7c112736acee

公鑰(未壓縮)如下所示:

0x0469eb01db87542d8ba782c8d80bbbe6ac0d474e91a89e9cee71570397acc3b1
 2089bd327411cf25940df653eb86a4de63740edf760ef6448a74e905668c9b57
 d0

引用自:https://ethereum.stackexchange.com/questions/43309