Adding a simple key to address derivation test
This commit is contained in:
parent
3e96bbc9b3
commit
e34596d0b4
1 changed files with 25 additions and 0 deletions
25
graphenej/src/test/java/cy/agorise/graphenej/KeyTest.java
Normal file
25
graphenej/src/test/java/cy/agorise/graphenej/KeyTest.java
Normal file
|
@ -0,0 +1,25 @@
|
|||
package cy.agorise.graphenej;
|
||||
|
||||
import junit.framework.Assert;
|
||||
|
||||
import org.bitcoinj.core.DumpedPrivateKey;
|
||||
import org.bitcoinj.core.ECKey;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* Created by nelson on 11/2/17.
|
||||
*/
|
||||
|
||||
public class KeyTest {
|
||||
|
||||
/**
|
||||
* Testing key to address derivation
|
||||
*/
|
||||
@Test
|
||||
public void testKeyToAddress(){
|
||||
String wif = "5J96pne45qWM1WpektoeazN6k9Mt93jQ7LyueRxFfEMTiy6yxjM";
|
||||
ECKey sourcePrivate = DumpedPrivateKey.fromBase58(null, wif).getKey();
|
||||
Address address = new Address(ECKey.fromPublicOnly(sourcePrivate.getPubKey()));
|
||||
Assert.assertEquals("Generated address matches expected one", address.toString(), "BTS8RiFgs8HkcVPVobHLKEv6yL3iXcC9SWjbPVS15dDAXLG9GYhnY");
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue