Code example for Stack

Methods: popadd

0
                    Utils.bytesToHexString(b));
    } 
 
    /** Replaces the top item in the stack with a hash160 of it */ 
    private void opHash160() { 
        byte[] buf = stack.pop();
        byte[] hash = Utils.sha256hash160(buf);
        stack.add(hash);
        log.debug("HASH160: output is {}", Utils.bytesToHexString(hash));
    } 
 
    /** Duplicates the top item on the stack */ 
    private void opDup() { 
        log.debug("DUP"); 
        stack.add(Arrays.clone(stack.lastElement()));
    } 
 
    ////////////////////// Interface for writing scripts from scratch //////////////////////////////// 
 
    /** Writes out the given byte buffer to the output stream with the correct opcode prefix */