Search in sources :

Example 16 with ScriptBuilder2

use of it.unica.tcs.lib.script.ScriptBuilder2 in project balzac by balzac-lang.

the class ScriptBuilder2Test method test_serialize_signature5.

@Test
public void test_serialize_signature5() {
    ECKey key = new ECKey();
    SigHash hashType = SigHash.NONE;
    ScriptBuilder2 sb = new ScriptBuilder2();
    sb.number(15);
    sb.signaturePlaceholder(key, hashType, false);
    String expected = "15 [sig," + ECKeyStore.getUniqueID(key) + ",*0]";
    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 17 with ScriptBuilder2

use of it.unica.tcs.lib.script.ScriptBuilder2 in project balzac by balzac-lang.

the class ScriptBuilder2Test method test_serialize_freeVariable.

@Test
public void test_serialize_freeVariable() {
    ScriptBuilder2 sb = new ScriptBuilder2();
    sb.number(15);
    sb.addVariable("Donald", String.class);
    String expected = "15 [var,Donald,java.lang.String]";
    String actual = sb.serialize();
    assertEquals(expected, actual);
}
Also used : ScriptBuilder2(it.unica.tcs.lib.script.ScriptBuilder2) Test(org.junit.Test)

Aggregations

ScriptBuilder2 (it.unica.tcs.lib.script.ScriptBuilder2)17 Test (org.junit.Test)17 ECKey (org.bitcoinj.core.ECKey)8 SigHash (org.bitcoinj.core.Transaction.SigHash)6 Script (org.bitcoinj.script.Script)6 Transaction (org.bitcoinj.core.Transaction)1 TransactionInput (org.bitcoinj.core.TransactionInput)1 MainNetParams (org.bitcoinj.params.MainNetParams)1