consenlabs / token-core-ios

a blockchain private key management library on iOS
Apache License 2.0
879 stars 229 forks source link

比特币生成公私钥错误? #57

Closed likuiliang closed 5 years ago

likuiliang commented 5 years ago

一:以下是通过如下代码生成的公私钥: var metadata = WalletMeta(source: .newIdentity) metadata.network = .testnet metadata.passwordHint = TestData.passwordHint metadata.name = "xyz" let mnemonicAndIdentity = try Identity.createIdentity(password: TestData.passwordHint, metadata: metadata) let identity = mnemonicAndIdentity.1 let wallets = identity.wallets[1]; let privateKey = try wallets.privateKey(password: TestData.passwordHint)

二:生成如下: privateKey: "tprv8g7S3tZQF1C3mqKcBYGezTEKGDw7d1fde3BEYHrF2VudJ6wrta5gC3SVQK6LNC5MhMawLpaAydg7mGHpudfSSrLGBZ8rd8eorGM3Nvde1WT" Address: "n33SgPgL4frd63Htnbr2MkyDgqQxmTVwBA" xpub: "80a63eac75abb3ab41f7386db5fb5bc0" walletID "8d132e2d-3ec4-487f-8d6a-add3f3299dfa" 三:问题如下: 1.生成的公私钥为何跟demo中提供的长度有很大差别,Demo中提供的私钥:"privateKey": "a392604efc2fad9c0b3da43b5f698a2e3f270f170d859912be0d54742275c5f6",是否生成方式错误?公钥也是一样,差别很大呀? 2.广播交易报错,mandatory-script-verify-flag-failed (Script failed an OP_EQUALVERIFY operation) (code 16),是否是公私钥签名错误?

likuiliang commented 5 years ago

已解决