oat_btc_mainnet.py 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. #!/usr/bin/env python3
  2. #
  3. # mmgen = Multi-Mode GENerator, command-line Bitcoin cold storage solution
  4. # Copyright (C)2013-2020 The MMGen Project <mmgen@tuta.io>
  5. """
  6. test.objattrtest_py_d.oat_btc_mainnet: BTC mainnet test vectors for MMGen data
  7. objects
  8. """
  9. from .oat_common import *
  10. sample_objs.update({
  11. 'PrivKey': PrivKey(seed_bin,compressed=True,pubkey_type='std'),
  12. 'WifKey': WifKey('5HwzecKMWD82ppJK3qMKpC7ohXXAwcyAN5VgdJ9PLFaAzpBG4sX'),
  13. 'CoinAddr': CoinAddr('1111111111111111111114oLvT2'),
  14. 'BTCAmt': BTCAmt('0.01'),
  15. 'MMGenID': MMGenID('F00F00BB:B:1'),
  16. 'TwMMGenID': TwMMGenID('F00F00BB:S:23'),
  17. })
  18. tests = {
  19. # addr.py
  20. 'AddrListEntry': atd({
  21. 'addr': (0b001, CoinAddr),
  22. 'idx': (0b001, AddrIdx),
  23. 'label': (0b101, TwComment),
  24. 'sec': (0b001, PrivKey),
  25. # 'viewkey': (0b001, ViewKey), # TODO
  26. # 'wallet_passwd': (0b001, WalletPassword), # TODO
  27. },
  28. [],
  29. {}
  30. ),
  31. 'PasswordListEntry': atd({
  32. 'passwd': (0b001, str),
  33. 'idx': (0b001, AddrIdx),
  34. 'label': (0b101, TwComment),
  35. 'sec': (0b001, PrivKey),
  36. },
  37. [],
  38. {'passwd':'ΑlphaΩmega', 'idx':1 },
  39. ),
  40. # obj.py
  41. 'PrivKey': atd({
  42. 'compressed': (0b001, bool),
  43. 'wif': (0b001, WifKey),
  44. },
  45. [seed_bin],
  46. {'compressed':True, 'pubkey_type':'std'},
  47. ),
  48. 'MMGenAddrType': atd({
  49. 'name': (0b001, str),
  50. 'pubkey_type': (0b001, str),
  51. 'compressed': (0b001, bool),
  52. 'gen_method': (0b001, str),
  53. 'addr_fmt': (0b001, str),
  54. 'wif_label': (0b001, str),
  55. 'extra_attrs': (0b001, tuple),
  56. 'desc': (0b001, str),
  57. },
  58. ['S'],
  59. {},
  60. ),
  61. # seed.py
  62. 'SeedBase': atd({
  63. 'data': (0b001, bytes),
  64. 'sid': (0b001, SeedID),
  65. },
  66. [seed_bin],
  67. {},
  68. ),
  69. 'SubSeed': atd({
  70. 'idx': (0b001, int),
  71. 'nonce': (0b001, int),
  72. 'ss_idx': (0b001, SubSeedIdx),
  73. },
  74. [sample_objs['SubSeedList'],1,1,'short'],
  75. {},
  76. ),
  77. 'SeedShareList': atd({
  78. 'count': (0b001, SeedShareCount),
  79. 'id_str': (0b001, SeedSplitIDString),
  80. },
  81. [sample_objs['Seed'],sample_objs['SeedShareCount']],
  82. {},
  83. ),
  84. 'SeedShareLast': atd({
  85. 'idx': (0b001, SeedShareIdx),
  86. },
  87. [sample_objs['SeedShareList']],
  88. {},
  89. ),
  90. 'SeedShareMaster': atd({
  91. 'idx': (0b001, MasterShareIdx),
  92. 'nonce': (0b001, int),
  93. },
  94. [sample_objs['SeedShareList'],7,0],
  95. {},
  96. ),
  97. 'SeedShareMasterJoining': atd({
  98. 'id_str': (0b001, SeedSplitIDString),
  99. 'count': (0b001, SeedShareCount),
  100. },
  101. [sample_objs['MasterShareIdx'], sample_objs['Seed'], 'foo', 2],
  102. {},
  103. ),
  104. # tw.py
  105. 'TwUnspentOutputs.MMGenTwUnspentOutput': atd({
  106. 'txid': (0b001, CoinTxID),
  107. 'vout': (0b001, int),
  108. 'amt': (0b001, BTCAmt),
  109. 'amt2': (0b001, BTCAmt),
  110. 'label': (0b101, TwComment),
  111. 'twmmid': (0b001, TwMMGenID),
  112. 'addr': (0b001, CoinAddr),
  113. 'confs': (0b001, int),
  114. 'scriptPubKey': (0b001, HexStr),
  115. 'days': (0b001, int),
  116. 'skip': (0b101, str),
  117. },
  118. [],
  119. {
  120. 'amt':BTCAmt('0.01'),
  121. 'twmmid':'F00F00BB:B:17',
  122. 'addr':'1111111111111111111114oLvT2',
  123. 'confs': 100000,
  124. 'scriptPubKey':'ff',
  125. },
  126. ),
  127. # tx.py
  128. 'MMGenTxInput': atd({
  129. 'vout': (0b001, int),
  130. 'amt': (0b001, BTCAmt),
  131. 'label': (0b101, TwComment),
  132. 'mmid': (0b001, MMGenID),
  133. 'addr': (0b001, CoinAddr),
  134. 'confs': (0b001, int),
  135. 'txid': (0b001, CoinTxID),
  136. 'have_wif': (0b011, bool),
  137. 'scriptPubKey': (0b001, HexStr),
  138. 'sequence': (0b001, int),
  139. },
  140. [],
  141. { 'amt':BTCAmt('0.01'), 'addr':sample_objs['CoinAddr'] },
  142. ),
  143. 'MMGenTxOutput': atd({
  144. 'vout': (0b001, int),
  145. 'amt': (0b001, BTCAmt),
  146. 'label': (0b101, TwComment),
  147. 'mmid': (0b001, MMGenID),
  148. 'addr': (0b001, CoinAddr),
  149. 'confs': (0b001, int),
  150. 'txid': (0b001, CoinTxID),
  151. 'have_wif': (0b011, bool),
  152. 'is_chg': (0b001, bool),
  153. },
  154. [],
  155. { 'amt':BTCAmt('0.01'), 'addr':sample_objs['CoinAddr'] },
  156. ),
  157. }
  158. tests['MMGenPasswordType'] = atd(tests['MMGenAddrType'].attrs, ['P'], {})