Package org.bitcoinj.script

Examples of org.bitcoinj.script.ScriptBuilder


    private Transaction addRandomInput(Transaction tx) {
        tx = new Transaction(params, tx.bitcoinSerialize());
        byte[] rand = new byte[32];
        new SecureRandom().nextBytes(rand);
        tx.addInput(new TransactionInput(params, tx, new ScriptBuilder().data(rand).build().getProgram()));
        return tx;
    }
View Full Code Here


        pledge.setTimestamp(Utils.currentTimeSeconds());
        pledge.setProjectId("abc");
        pledge.getPledgeDetailsBuilder();
        Project project = new Project(projectBuilder.build());
        TransactionOutput badOutput = new TransactionOutput(params, null, val,
                new ScriptBuilder().op(ScriptOpCodes.OP_TRUE).build().getProgram());
        List<TransactionOutput> outputs = ImmutableList.of(badOutput);
        checkedGet(project.verifyPledge(outPoints -> completedFuture(outputs), pledge.build()));
    }
View Full Code Here

    public void nonStandardInputRegularOutput() throws Exception {
        // Unconsumed stack items are not allowed.
        TxData pledgeTX = makePledge(details, 0.1);
        TransactionInput input = pledgeTX.pledge.getInput(0);
        input.setScriptSig(
                new ScriptBuilder(input.getScriptSig())
                        .data(0, new byte[]{})
                        .build()
        );
        LHProtos.Pledge.Builder pledge = pledgeToBuilder(pledgeTX, false);
        Project project = new Project(projectBuilder.build());
View Full Code Here

        // Unconsumed stack items are not allowed.
        TxData pledgeTX = makePledge(details, 0.1);
        TransactionInput input = pledgeTX.pledge.getInput(0);
        TransactionOutput origOutput = pledgeTX.fakeStub.getOutput(0);
        Script p2shPK = ScriptBuilder.createP2SHOutputScript(origOutput.getScriptPubKey());
        Script p2shSS = new ScriptBuilder(input.getScriptSig()).data(origOutput.getScriptBytes()).data(0, new byte[]{}).build();
        input.setScriptSig(p2shSS);
        pledgeTX.fakeStub.clearOutputs();
        pledgeTX.fakeStub.addOutput(origOutput.getValue(), p2shPK);
        LHProtos.Pledge.Builder pledge = pledgeToBuilder(pledgeTX, false);
        Project project = new Project(projectBuilder.build());
View Full Code Here

TOP

Related Classes of org.bitcoinj.script.ScriptBuilder

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.