I am currently a computer science Ph.D. student at University at Buffalo. My main area of focus is cyber-security, malware analysis, blockchain concepts, application development, and computer networking. My long-term goal is to be a good teacher and researcher.


Common Creative License from Flickr by KylaBorg

What is BARTS?

BARTS is a tool that was developed to help illustrate the concepts of how blockchain mining works. Individuals are encouraged to go through the BARTS exercise links, and then they are sent to the links to the BARTS Blockchain Simulation. The BARTS Blockchain Simulation demonstrates how blockchain mining works and how data is added to the blockchain through an art selling exercise.

HICSS 2020 Blockchain Art Simulation Workshop

Simulation Links

BARTS Exercise Links

  • EXERCISE 1 (Generate a nonce that will result in a leading zero for a hash)
  • EXERCISE 2 (A Hashing program that automatically searches for a nonce)
  • EXERCISE 3 (Mining Computation Issues)
  • EXERCISE 4 (Birthday Paradox and cracking secure hash algorithms)

HICSS 2021 Comparing Soot and APKTool Injection


Presentation Material

Video Presentation

UB Compilers Class​: Injecting Blockchain Calls with the Soot Framework

Smart contract Solidity Code

pragma solidity >=0.5.15;

contract ApplicationContract{

	string Name ="";

	function SetName(string memory statedata) public{
		Name = statedata;

	function Hello()public view returns(string memory){
		return Name;

Code for pom.xml file

<project xmlns="" xmlns:xsi="" xsi:schemaLocation="">

Java file (

import soot.Body;
import soot.BodyTransformer;
import soot.Local;
import soot.PackManager;
import soot.PatchingChain;
import soot.RefType;
import soot.Scene;
import soot.SootClass;
import soot.SootMethodRef;
import soot.SootResolver;
import soot.Transform;
import soot.Type;
import soot.Unit;
import soot.Value;
import soot.VoidType;
import soot.javaToJimple.LocalGenerator;
import soot.jimple.AssignStmt;
import soot.jimple.InvokeStmt;
import soot.jimple.Jimple;
import soot.jimple.StringConstant;
import soot.jimple.VirtualInvokeExpr;

import java.util.*; 

public class HicssSootAnalysis
    static String EntryPointApp = "com.example.simpleapplication.MainActivity";
    static String EntryPointBlockchain = "com.example.simpleapplication.Hello";
    static String RemoteFunctionCallWeb3J = "org.web3j.protocol.core.RemoteFunctionCall";
    static String SendAsync = "org.web3j.protocol.core.RemoteFunctionCall: java.util.concurrent.CompletableFuture sendAsync()";
    static Local ContractReference = null;
    static Value BlockchainContractStmt = null;
    public static void main(String[] args)
         PackManager.v().getPack("jtp").add(new Transform("jtp.myInstrumenter", new BodyTransformer() {   
            protected void internalTransform(final Body body, String phaseName, @SuppressWarnings("rawtypes") Map options) {
                final PatchingChain<Unit> units = body.getUnits();                              
                IterateOverAllUnits(units, body);               
    private static void IterateOverAllUnits(PatchingChain<Unit> units, Body body) {
        String StringLastKnownUnit = "";   
//        int counter = 0;
        for(Iterator<Unit> UnitIterator = units.snapshotIterator(); UnitIterator.hasNext();) { 
            final Unit LastKnownUnit =; 
            StringLastKnownUnit = LastKnownUnit.toString();
            if(Check_If_SetContentView_Exists(StringLastKnownUnit)) { 
            	//ADD LOCALS
                LocalGenerator l = new LocalGenerator(body);               
                // Create $r3 = $r0.<com.example.simpleapplication.MainActivity: com.example.simpleapplication.Hello contract>;
                LinkedList<Value> ContractInitArgs = new LinkedList<>();
                AssignStmt AssignStmtContract = Jimple.v().newAssignStmt(Return_Local(body, "Hello"),Jimple.v().newVirtualInvokeExpr(Return_Local(body,"MainActivity"), Scene.v().getMethod("<"+ EntryPointApp +": "+ EntryPointBlockchain +" ContractInit()>").makeRef(), ContractInitArgs));
                units.insertAfter(AssignStmtContract, LastKnownUnit);
                // Create $r2 = virtualinvoke $r3.<com.example.simpleapplication.Hello: org.web3j.protocol.core.RemoteFunctionCall SetName(java.lang.String)>("John");
                LinkedList<Value> ContractPersonName = new LinkedList<>();
                AssignStmt AssignStmtContractFunc = Jimple.v().newAssignStmt(Return_Local(body, "RemoteFunctionCall"),Jimple.v().newVirtualInvokeExpr(Return_Local(body,"Hello"), Scene.v().getMethod("<"+ EntryPointBlockchain +": "+ RemoteFunctionCallWeb3J +" SetName(java.lang.String)>").makeRef(), ContractPersonName));
                units.insertAfter(AssignStmtContractFunc, AssignStmtContract);
                // Create virtualinvoke $r2.<org.web3j.protocol.core.RemoteFunctionCall: java.util.concurrent.CompletableFuture sendAsync()>();
                List<String> BlockchainArgumentsForSendAsync = new LinkedList<>();
                SootMethodRef SendAsyncMethodRef = makeMethodRef("org.web3j.protocol.core.RemoteCall","sendAsync", "java.util.concurrent.CompletableFuture",BlockchainArgumentsForSendAsync, false);
                VirtualInvokeExpr InvokeExprSendAsync = Jimple.v().newVirtualInvokeExpr(Return_Local(body,"RemoteFunctionCall"), SendAsyncMethodRef, Collections.<Value>emptyList());
                InvokeStmt InvokeStatementSendAsync = Jimple.v().newInvokeStmt(InvokeExprSendAsync);
                units.insertAfter(InvokeStatementSendAsync, (Unit) AssignStmtContractFunc);
    public static SootMethodRef makeMethodRef(String cName, String mName, String rType, List<String> pTypes,
            boolean isStatic) {
           SootClass sc = SootResolver.v().makeClassRef(cName);
           Type returnType = null;
           if (rType == "") {
            returnType = VoidType.v();
           } else {
            returnType = RefType.v(rType);
           List<Type> parameterTypes = new ArrayList<Type>();
           for (String p : pTypes) {
           return Scene.v().makeMethodRef(sc, mName, parameterTypes, returnType, isStatic);
    private static Local Return_Local(Body b, String name) {
        for (Local local : b.getLocals()) {
	         if (local.getType().toString().contains(name)) {
	          return local;
        return null;

    private static boolean Check_If_SetContentView_Exists(String StringLastKnownUnit) {
        if(Contains_Match_Case(StringLastKnownUnit, EntryPointApp) && Contains_Match_Case(StringLastKnownUnit, "SetContentView")) {
            return true;
        }else {
            return false;
    public static boolean Contains_Match_Case(String str, String subString) {
        return str.toLowerCase().contains(subString.toLowerCase());

UB GenCyber Smart Contract Page

BARTS Blockchain Documents DSI

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s