Search in sources :

Example 1 with SigHash

use of org.bitcoinj.core.Transaction.SigHash in project balzac by balzac-lang.

the class ScriptBuilder2Test method test_serialize_signature1.

@Test
public void test_serialize_signature1() {
    ECKey key = new ECKey();
    SigHash hashType = SigHash.ALL;
    ScriptBuilder2 sb = new ScriptBuilder2();
    sb.number(15);
    sb.signaturePlaceholder(key, hashType, false);
    String expected = "15 [sig," + ECKeyStore.getUniqueID(key) + ",**]";
    String actual = sb.serialize();
    assertEquals(expected, actual);
}
Also used : SigHash(org.bitcoinj.core.Transaction.SigHash) ScriptBuilder2(it.unica.tcs.lib.script.ScriptBuilder2) ECKey(org.bitcoinj.core.ECKey) Test(org.junit.Test)

Example 2 with SigHash

use of org.bitcoinj.core.Transaction.SigHash in project balzac by balzac-lang.

the class ScriptBuilder2Test method test_serialize_signature2.

@Test
public void test_serialize_signature2() {
    ECKey key = new ECKey();
    SigHash hashType = SigHash.ALL;
    ScriptBuilder2 sb = new ScriptBuilder2();
    sb.number(15);
    sb.signaturePlaceholder(key, hashType, true);
    String expected = "15 [sig," + ECKeyStore.getUniqueID(key) + ",1*]";
    String actual = sb.serialize();
    assertEquals(expected, actual);
}
Also used : SigHash(org.bitcoinj.core.Transaction.SigHash) ScriptBuilder2(it.unica.tcs.lib.script.ScriptBuilder2) ECKey(org.bitcoinj.core.ECKey) Test(org.junit.Test)

Example 3 with SigHash

use of org.bitcoinj.core.Transaction.SigHash in project balzac by balzac-lang.

the class ScriptBuilder2Test method test_serialize_signature6.

@Test
public void test_serialize_signature6() {
    ECKey key = new ECKey();
    SigHash hashType = SigHash.NONE;
    ScriptBuilder2 sb = new ScriptBuilder2();
    sb.number(15);
    sb.signaturePlaceholder(key, hashType, true);
    String expected = "15 [sig," + ECKeyStore.getUniqueID(key) + ",10]";
    String actual = sb.serialize();
    assertEquals(expected, actual);
}
Also used : SigHash(org.bitcoinj.core.Transaction.SigHash) ScriptBuilder2(it.unica.tcs.lib.script.ScriptBuilder2) ECKey(org.bitcoinj.core.ECKey) Test(org.junit.Test)

Example 4 with SigHash

use of org.bitcoinj.core.Transaction.SigHash in project balzac by balzac-lang.

the class ScriptBuilder2Test method test_serialize_signature4.

@Test
public void test_serialize_signature4() {
    ECKey key = new ECKey();
    SigHash hashType = SigHash.SINGLE;
    ScriptBuilder2 sb = new ScriptBuilder2();
    sb.number(15);
    sb.signaturePlaceholder(key, hashType, true);
    String expected = "15 [sig," + ECKeyStore.getUniqueID(key) + ",11]";
    String actual = sb.serialize();
    assertEquals(expected, actual);
}
Also used : SigHash(org.bitcoinj.core.Transaction.SigHash) ScriptBuilder2(it.unica.tcs.lib.script.ScriptBuilder2) ECKey(org.bitcoinj.core.ECKey) Test(org.junit.Test)

Example 5 with SigHash

use of org.bitcoinj.core.Transaction.SigHash in project balzac by balzac-lang.

the class ScriptBuilder2Test method test_serialize_signature3.

@Test
public void test_serialize_signature3() {
    ECKey key = new ECKey();
    SigHash hashType = SigHash.SINGLE;
    ScriptBuilder2 sb = new ScriptBuilder2();
    sb.number(15);
    sb.signaturePlaceholder(key, hashType, false);
    String expected = "15 [sig," + ECKeyStore.getUniqueID(key) + ",*1]";
    String actual = sb.serialize();
    assertEquals(expected, actual);
}
Also used : SigHash(org.bitcoinj.core.Transaction.SigHash) ScriptBuilder2(it.unica.tcs.lib.script.ScriptBuilder2) ECKey(org.bitcoinj.core.ECKey) Test(org.junit.Test)

Aggregations

ECKey (org.bitcoinj.core.ECKey)7 SigHash (org.bitcoinj.core.Transaction.SigHash)7 ScriptBuilder2 (it.unica.tcs.lib.script.ScriptBuilder2)6 Test (org.junit.Test)6 ArrayList (java.util.ArrayList)1 Sha256Hash (org.bitcoinj.core.Sha256Hash)1 TransactionSignature (org.bitcoinj.crypto.TransactionSignature)1 ScriptChunk (org.bitcoinj.script.ScriptChunk)1