simolus3 / web3dart

Ethereum library, written in Dart.
MIT License
442 stars 270 forks source link

Inferring a public key from a private key sometimes pays off incorrectly #161

Closed EvnLi closed 3 years ago

EvnLi commented 3 years ago

I/flutter ( 7326): mnemonic -----------oxygen rally sponsor phone prize category spy provide arrow search raven middle------------- I/flutter ( 7326): -----------true------------- I/flutter ( 7326): -----------[58, 80, 171, 10, 239, 51, 160, 0, 137, 167, 226, 56, 3, 131, 227, 211, 232, 139, 218, 106, 70, 236, 127, 142, 60, 72, 180, 209, 234, 206, 153, 111, 97, 68, 65, 20, 250, 105, 97, 49, 122, 162, 245, 95, 246, 68, 187, 146, 24, 85, 240, 45, 167, 152, 5, 81, 34, 76, 191, 97, 72, 122, 8, 108]------------- I/flutter ( 7326): private Key => [240, 238, 90, 88, 70, 13, 83, 89, 224, 236, 102, 113, 67, 67, 186, 9, 117, 119, 221, 184, 238, 47, 162, 227, 38, 126, 119, 169, 152, 183, 78, 40] I/flutter ( 7326): root.toWIF => KycXqyaqzz62y7fhKLcrzdJQymcfHhffxJNxMyLKGwaX7AVKKkWw I/flutter ( 7326): hex private Key => f0ee5a58460d5359e0ec66714343ba097577ddb8ee2fa2e3267e77a998b74e28 I/flutter ( 7326): privatexx Key => [0, 255, 4, 21, 201, 213, 25, 155, 44, 19, 143, 222, 165, 73, 174, 237, 161, 242, 69, 253, 119, 162, 208, 241, 230, 227, 41, 204, 182, 42, 157, 108, 140] E/flutter ( 7326): [ERROR:flutter/lib/ui/ui_dart_state.cc(186)] Unhandled Exception: Invalid argument(s): The multiplicator cannot be negative E/flutter ( 7326): #0 ECPointBase.* package:pointycastle/ecc/ecc_base.dart:142 E/flutter ( 7326): #1 privateKeyToPublic package:web3dart/…/crypto/secp256k1.dart:30 E/flutter ( 7326): #2 main package:my_flrst_flutter_app/main.dart:44 E/flutter ( 7326): #3 _runMainZoned.. (dart:ui/hooks.dart:140:25) E/flutter ( 7326): #4 _rootRun (dart:async/zone.dart:1354:13) E/flutter ( 7326): #5 _CustomZone.run (dart:async/zone.dart:1258:19) E/flutter ( 7326): #6 _runZoned (dart:async/zone.dart:1788:10) E/flutter ( 7326): #7 runZonedGuarded (dart:async/zone.dart:1776:12) E/flutter ( 7326): #8 _runMainZoned. (dart:ui/hooks.dart:133:5) E/flutter ( 7326): #9 _delayEntrypointInvocation. (dart:isolate-patch/isolate_patch.dart:283:19) E/flutter ( 7326): #10 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:184:12) E/flutter ( 7326):

simolus3 commented 3 years ago

Can you post the code that created the private key?

EvnLi commented 3 years ago

Can you post the code that created the private key?

The bug of conversion between Uint8List and BigInt has been solved. Thank you