add wownero script

This commit is contained in:
fuwa
2018-07-13 18:31:53 +08:00
parent 4f45f6188c
commit c99633133f
13 changed files with 31 additions and 155 deletions
@@ -266,11 +266,11 @@ public class LoginFragment extends Fragment implements WalletInfoAdapter.OnInter
private String addressPrefix() {
switch (WalletManager.getInstance().getNetworkType()) {
case NetworkType_Testnet:
return "9A-";
return "-";
case NetworkType_Mainnet:
return "4-";
return "Wo-";
case NetworkType_Stagenet:
return "5-";
return "-";
default:
throw new IllegalStateException("Unsupported Network: " + WalletManager.getInstance().getNetworkType());
}
@@ -369,10 +369,10 @@ public class LoginFragment extends Fragment implements WalletInfoAdapter.OnInter
private static final String PREF_DAEMON_MAINNET = "daemon_mainnet";
private static final String PREF_DAEMONLIST_MAINNET =
"node.moneroworld.com:18089;node.xmrbackb.one;node.xmr.be";
"192.168.10.100:34568";
private static final String PREF_DAEMONLIST_STAGENET =
"stagenet.monerujo.io;stagenet.xmr-tw.org";
"192.168.10.200";
private NodeList daemonStageNet;
private NodeList daemonMainNet;
@@ -67,13 +67,13 @@ public class WalletNode {
} else {
switch (networkType) {
case NetworkType_Mainnet:
port = 18081;
port = 34568;
break;
case NetworkType_Testnet:
port = 28081;
port = 11180;
break;
case NetworkType_Stagenet:
port = 38081;
port = 38080;
break;
default:
port = 0;
@@ -36,7 +36,8 @@ import com.m2049r.xmrwallet.util.UserNotes;
import timber.log.Timber;
public class SendSettingsWizardFragment extends SendWizardFragment {
final static public int MIXIN = 6;
// see: https://github.com/wownero/wownero/blob/master/src/cryptonote_config.h#L138
final static public int MIXIN = 9;
public static SendSettingsWizardFragment newInstance(Listener listener) {
SendSettingsWizardFragment instance = new SendSettingsWizardFragment();
@@ -309,10 +309,6 @@ public class Wallet {
this.listenerHandle = setListenerJ(listener);
}
public native int getDefaultMixin();
public native void setDefaultMixin(int mixin);
public native boolean setUserNote(String txid, String note);
public native String getUserNote(String txid);
@@ -76,7 +76,7 @@ import okhttp3.HttpUrl;
import timber.log.Timber;
public class Helper {
static public final String CRYPTO = "XMR";
static public final String CRYPTO = "WOW";
static private final String WALLET_DIR = "monerujo" + (BuildConfig.DEBUG ? "-debug" : "");
static private final String HOME_DIR = "monero" + (BuildConfig.DEBUG ? "-debug" : "");
@@ -367,18 +367,6 @@ public class Helper {
return crazyPass;
}
// or maybe it is a broken CrAzYpass? (of which we have two variants)
String brokenCrazyPass2 = KeyStoreHelper.getBrokenCrazyPass(context, password, 2);
if ((brokenCrazyPass2 != null)
&& WalletManager.getInstance().verifyWalletPassword(walletPath, brokenCrazyPass2, true)) {
return brokenCrazyPass2;
}
String brokenCrazyPass1 = KeyStoreHelper.getBrokenCrazyPass(context, password, 1);
if ((brokenCrazyPass1 != null)
&& WalletManager.getInstance().verifyWalletPassword(walletPath, brokenCrazyPass1, true)) {
return brokenCrazyPass1;
}
return null;
}
@@ -61,7 +61,7 @@ public class KeyStoreHelper {
System.loadLibrary("monerujo");
}
public static native byte[] slowHash(byte[] data, int brokenVariant);
public static native byte[] slowHash(byte[] data);
static final private String RSA_ALIAS = "MonerujoRSA";
@@ -71,7 +71,7 @@ public class KeyStoreHelper {
try {
KeyStoreHelper.createKeys(context, RSA_ALIAS);
sig = KeyStoreHelper.signData(RSA_ALIAS, data);
byte[] hash = slowHash(sig, brokenVariant);
byte[] hash = slowHash(sig);
if (hash == null) {
throw new IllegalStateException("Slow Hash is null!");
}
@@ -87,30 +87,6 @@ public class KeyStoreHelper {
return getCrazyPass(context, password, 0);
}
public static String getBrokenCrazyPass(Context context, String password, int brokenVariant) {
// due to a link bug in the initial implementation, some crazypasses were built with
// prehash & variant == 1
// since there are wallets out there, we need to keep this here
// yes, it's a mess
if (isArm32() && (brokenVariant != 2)) return null;
return getCrazyPass(context, password, brokenVariant);
}
private static Boolean isArm32 = null;
public static boolean isArm32() {
if (isArm32 != null) return isArm32;
synchronized (KeyStoreException.class) {
if (isArm32 != null) return isArm32;
if (Build.SUPPORTED_ABIS[0].equals("armeabi-v7a")) {
isArm32 = true;
} else {
isArm32 = false;
}
return isArm32;
}
}
public static boolean saveWalletUserPass(@NonNull Context context, String wallet, String password) {
String walletKeyAlias = SecurityConstants.WALLET_PASS_KEY_PREFIX + wallet;
byte[] data = password.getBytes(StandardCharsets.UTF_8);
@@ -45,18 +45,6 @@ public class Notice {
synchronized (Notice.class) {
if (notices != null) return;
notices = new ArrayList<>();
notices.add(
new Notice(NOTICE_SHOW_XMRTO_ENABLED_SEND,
R.string.info_xmrto_enabled,
R.string.help_xmrto,
1)
);
notices.add(
new Notice(NOTICE_SHOW_XMRTO_ENABLED_LOGIN,
R.string.info_xmrto_enabled,
R.string.help_xmrto,
1)
);
notices.add(
new Notice(NOTICE_SHOW_CRAZYPASS,
R.string.info_crazypass_enabled,
@@ -41,54 +41,9 @@ public class RestoreHeight {
private Map<String, Long> blockheight = new HashMap<>();
RestoreHeight() {
blockheight.put("2014-05-01", 18844L);
blockheight.put("2014-06-01", 65406L);
blockheight.put("2014-07-01", 108882L);
blockheight.put("2014-08-01", 153594L);
blockheight.put("2014-09-01", 198072L);
blockheight.put("2014-10-01", 241088L);
blockheight.put("2014-11-01", 285305L);
blockheight.put("2014-12-01", 328069L);
blockheight.put("2015-01-01", 372369L);
blockheight.put("2015-02-01", 416505L);
blockheight.put("2015-03-01", 456631L);
blockheight.put("2015-04-01", 501084L);
blockheight.put("2015-05-01", 543973L);
blockheight.put("2015-06-01", 588326L);
blockheight.put("2015-07-01", 631187L);
blockheight.put("2015-08-01", 675484L);
blockheight.put("2015-09-01", 719725L);
blockheight.put("2015-10-01", 762463L);
blockheight.put("2015-11-01", 806528L);
blockheight.put("2015-12-01", 849041L);
blockheight.put("2016-01-01", 892866L);
blockheight.put("2016-02-01", 936736L);
blockheight.put("2016-03-01", 977691L);
blockheight.put("2016-04-01", 1015848L);
blockheight.put("2016-05-01", 1037417L);
blockheight.put("2016-06-01", 1059651L);
blockheight.put("2016-07-01", 1081269L);
blockheight.put("2016-08-01", 1103630L);
blockheight.put("2016-09-01", 1125983L);
blockheight.put("2016-10-01", 1147617L);
blockheight.put("2016-11-01", 1169779L);
blockheight.put("2016-12-01", 1191402L);
blockheight.put("2017-01-01", 1213861L);
blockheight.put("2017-02-01", 1236197L);
blockheight.put("2017-03-01", 1256358L);
blockheight.put("2017-04-01", 1278622L);
blockheight.put("2017-05-01", 1300239L);
blockheight.put("2017-06-01", 1322564L);
blockheight.put("2017-07-01", 1344225L);
blockheight.put("2017-08-01", 1366664L);
blockheight.put("2017-09-01", 1389113L);
blockheight.put("2017-10-01", 1410738L);
blockheight.put("2017-11-01", 1433039L);
blockheight.put("2017-12-01", 1454639L);
blockheight.put("2018-01-01", 1477201L);
blockheight.put("2018-02-01", 1499599L);
blockheight.put("2018-03-01", 1519796L);
blockheight.put("2018-04-01", 1542067L);
blockheight.put("2018-05-01", 8700L);
blockheight.put("2018-06-01", 17500L);
blockheight.put("2018-07-01", 26000L);
}
public long getHeight(String date) {
@@ -100,9 +55,9 @@ public class RestoreHeight {
cal.set(Calendar.DST_OFFSET, 0);
cal.setTime(parser.parse(date));
cal.add(Calendar.DAY_OF_MONTH, -4); // give it some leeway
if (cal.get(Calendar.YEAR) < 2014)
if (cal.get(Calendar.YEAR) < 2018)
return 1;
if ((cal.get(Calendar.YEAR) == 2014) && (cal.get(Calendar.MONTH) <= 3))
if ((cal.get(Calendar.YEAR) == 2018) && (cal.get(Calendar.MONTH) <= 4))
// before May 2014
return 1;
@@ -119,7 +74,7 @@ public class RestoreHeight {
// if too recent, go back in time and find latest one we have
while (prevBc == null) {
cal.add(Calendar.MONTH, -1);
if (cal.get(Calendar.YEAR) < 2014) {
if (cal.get(Calendar.YEAR) < 2018) {
throw new IllegalStateException("endless loop looking for blockheight");
}
prevTime = cal.getTimeInMillis();