Added BIP39 ECKey creation

This commit is contained in:
Henry Varona 2016-11-22 15:12:44 -04:30
parent a611f9b388
commit 51bed577aa
3 changed files with 605 additions and 573 deletions

View file

@ -0,0 +1,23 @@
package com.luminiasoft.bitshares;
import java.util.Arrays;
import org.bitcoinj.core.ECKey;
import org.bitcoinj.crypto.HDKeyDerivation;
import org.bitcoinj.crypto.MnemonicCode;
/**
*
* @author hvarona
*/
public class BIP39 {
private ECKey mPrivateKey;
public BIP39(String words, String passphrase) {
byte[] seed = MnemonicCode.toSeed(Arrays.asList(words.split(" ")), passphrase);
mPrivateKey = HDKeyDerivation.createMasterPrivateKey(seed);
}
}

View file

@ -1,64 +1,66 @@
package com.luminiasoft.bitshares;
import org.bitcoinj.core.ECKey;
import java.io.IOException;
public class Main {
// Brain key from Nelson's app referencing the bilthon-83 account
public static final String BRAIN_KEY = "PUMPER ISOTOME SERE STAINER CLINGER MOONLIT CHAETA UPBRIM AEDILIC BERTHER NIT SHAP SAID SHADING JUNCOUS CHOUGH";
// WIF from Nelson's app referencing the bilthon-83 account
public static final String WIF = "5J96pne45qWM1WpektoeazN6k9Mt93jQ7LyueRxFfEMTiy6yxjM";
// WIF from the cli_wallet instance
// public static final String WIF = "5KMzB2GqGhnh7ufhgddmz1eKPHS72uTLeL9hHjSvPb1UywWknF5";
public static final String EXTERNAL_SIGNATURE = "1f36c41acb774fcbc9c231b5895ec9701d6872729098d8ea56d78dda72a6b54252694db85d7591de5751b7aea06871da15d63a1028758421607ffc143e53ef3306";
// Static block information used for transaction serialization tests
public static int REF_BLOCK_NUM = 56204;
public static int REF_BLOCK_PREFIX = 1614747814;
public static int RELATIVE_EXPIRATION = 1478385607;
public static void main(String[] args) {
Test test = new Test();
// test.testTransactionSerialization();
// ECKey.ECDSASignature signature = test.testSigning();
// try {
// test.testWebSocketTransfer();
// } catch (IOException e) {
// e.printStackTrace();
// }
// test.testCustomSerializer();
// test.testTransactionSerialization();
// test.testLoginSerialization();
// test.testNetworkBroadcastSerialization();
// test.testNetworkBroadcastDeserialization();
// test.testGetDynamicParams();
// test.testGetRequiredFeesSerialization();
// test.testRequiredFeesResponse();
// test.testTransactionBroadcastSequence();
// test.testAccountLookupDeserialization();
// test.testPrivateKeyManipulations();
// test.testGetAccountByName();
// test.testGetRequiredFees();
// test.testRandomNumberGeneration();
test.testBrainKeyOperations();
}
}
package com.luminiasoft.bitshares;
import org.bitcoinj.core.ECKey;
import java.io.IOException;
public class Main {
// Brain key from Nelson's app referencing the bilthon-83 account
public static final String BRAIN_KEY = "PUMPER ISOTOME SERE STAINER CLINGER MOONLIT CHAETA UPBRIM AEDILIC BERTHER NIT SHAP SAID SHADING JUNCOUS CHOUGH";
public static final String BIP39_KEY = "abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about";
// WIF from Nelson's app referencing the bilthon-83 account
public static final String WIF = "5J96pne45qWM1WpektoeazN6k9Mt93jQ7LyueRxFfEMTiy6yxjM";
// WIF from the cli_wallet instance
// public static final String WIF = "5KMzB2GqGhnh7ufhgddmz1eKPHS72uTLeL9hHjSvPb1UywWknF5";
public static final String EXTERNAL_SIGNATURE = "1f36c41acb774fcbc9c231b5895ec9701d6872729098d8ea56d78dda72a6b54252694db85d7591de5751b7aea06871da15d63a1028758421607ffc143e53ef3306";
// Static block information used for transaction serialization tests
public static int REF_BLOCK_NUM = 56204;
public static int REF_BLOCK_PREFIX = 1614747814;
public static int RELATIVE_EXPIRATION = 1478385607;
public static void main(String[] args) {
Test test = new Test();
// test.testTransactionSerialization();
// ECKey.ECDSASignature signature = test.testSigning();
// try {
// test.testWebSocketTransfer();
// } catch (IOException e) {
// e.printStackTrace();
// }
// test.testCustomSerializer();
// test.testTransactionSerialization();
// test.testLoginSerialization();
// test.testNetworkBroadcastSerialization();
// test.testNetworkBroadcastDeserialization();
// test.testGetDynamicParams();
// test.testGetRequiredFeesSerialization();
// test.testRequiredFeesResponse();
// test.testTransactionBroadcastSequence();
// test.testAccountLookupDeserialization();
// test.testPrivateKeyManipulations();
// test.testGetAccountByName();
// test.testGetRequiredFees();
// test.testRandomNumberGeneration();
test.testBrainKeyOperations();
test.testBip39Opertion();
}
}

File diff suppressed because it is too large Load diff