ot_btc_testnet.py 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. #!/usr/bin/env python3
  2. #
  3. # mmgen = Multi-Mode GENerator, command-line Bitcoin cold storage solution
  4. # Copyright (C)2013-2023 The MMGen Project <mmgen@tuta.io>
  5. """
  6. test.objtest_py_d.ot_btc_testnet: BTC testnet test vectors for MMGen data objects
  7. """
  8. from mmgen.obj import *
  9. from .ot_common import *
  10. from ..include.common import cfg
  11. from mmgen.protocol import init_proto
  12. proto = init_proto( cfg, 'btc', network='testnet', need_amt=True )
  13. tests = {
  14. 'CoinAddr': {
  15. 'bad': (
  16. {'addr':1, 'proto':proto},
  17. {'addr':'x', 'proto':proto},
  18. {'addr':'я', 'proto':proto},
  19. ),
  20. 'good': (
  21. {'addr':'n2FgXPKwuFkCXF946EnoxWJDWF2VwQ6q8J', 'proto':proto},
  22. {'addr':'2MspvWFjBbkv2wzQGqhxJUYPCk3Y2jMaxLN','proto':proto},
  23. ),
  24. },
  25. 'WifKey': {
  26. 'bad': (
  27. {'proto':proto, 'wif':1},
  28. {'proto':proto, 'wif':[]},
  29. {'proto':proto, 'wif':'\0'},
  30. {'proto':proto, 'wif':'\1'},
  31. {'proto':proto, 'wif':'я'},
  32. {'proto':proto, 'wif':'g'},
  33. {'proto':proto, 'wif':'gg'},
  34. {'proto':proto, 'wif':'FF'},
  35. {'proto':proto, 'wif':'f00'},
  36. {'proto':proto, 'wif':r16.hex()},
  37. {'proto':proto, 'wif':'2MspvWFjBbkv2wzQGqhxJUYPCk3Y2jMaxLN'},
  38. ),
  39. 'good': (
  40. {'proto':proto, 'wif':'93HsQEpH75ibaUJYi3QwwiQxnkW4dUuYFPXZxcbcKds7XrqHkY6', 'ret_idx':1},
  41. {'proto':proto, 'wif':'cMsqcmDYZP1LdKgqRh9L4ZRU9br28yvdmTPwW2YQwVSN9aQiMAoR', 'ret_idx':1},
  42. )
  43. },
  44. 'PrivKey': {
  45. 'bad': (
  46. {'proto':proto, 'wif':1},
  47. {'proto':proto, 'wif':'1'},
  48. {'proto':proto, 'wif':'5KXEpVzjWreTcQoG5hX357s1969MUKNLuSfcszF6yu84kpsNZKb'},
  49. {'proto':proto, 's':r32,'wif':'5KXEpVzjWreTcQoG5hX357s1969MUKNLuSfcszF6yu84kpsNZKb'},
  50. {'proto':proto, 'pubkey_type':'std'},
  51. {'proto':proto, 's':r32},
  52. {'proto':proto, 's':r32,'compressed':'yes'},
  53. {'proto':proto, 's':r32,'compressed':'yes','pubkey_type':'std'},
  54. {'proto':proto, 's':r32,'compressed':True,'pubkey_type':'nonstd'},
  55. {'proto':proto, 's':r32+b'x','compressed':True,'pubkey_type':'std'}
  56. ),
  57. 'good': (
  58. {'proto':proto, 'wif':'93HsQEpH75ibaUJYi3QwwiQxnkW4dUuYFPXZxcbcKds7XrqHkY6',
  59. 'ret':bytes.fromhex('e0aef965b905a2fedf907151df8e0a6bac832aa697801c51f58bd2ecb4fd381c')},
  60. {'proto':proto, 'wif':'cMsqcmDYZP1LdKgqRh9L4ZRU9br28yvdmTPwW2YQwVSN9aQiMAoR',
  61. 'ret':bytes.fromhex('08d0ed83b64b68d56fa064be48e2385060ed205be2b1e63cd56d218038c3a05f')},
  62. {'proto':proto, 's':r32,'compressed':False,'pubkey_type':'std','ret':r32},
  63. {'proto':proto, 's':r32,'compressed':True,'pubkey_type':'std','ret':r32}
  64. ),
  65. },
  66. }