---
# System prepended metadata

title: BLOCKchain

---

# BLOCKchain 

Main creates a **Calculator** object and an **Assembly** object

Checks for every executed tick if completed was set to 1, else executes a new tick.

## Calculator init

completed = 0
dog = new Dog()
good = new Good()
worker_count = 5 (his own id)
q = new DispatchQueue()

## Assembly init

**Assembles the output string ?**
known = mutableArraydfs

extends:
	-> appends ?? to the flag

f
	-> assembly::known()
	-> componentsJoinedByString (b'\x00')

gotchar:i
	-> assembly::known()
	-> assembly::count()
	-> extend if i is not enough
	-> c = chr(gotChar)
	-> setObject:atIndexedSubscript(c, i)

Calculator tick:
	- hmmm()
	- alloc new worker
	- get the dog, the good of the new worker
	- get the first callback
	- worker.initwithcast\:dog:good:cb




## Dog init

not found yet


## Freebies 

**prints the first 5 character of the flag : "flag{"**


## hmm%d%d

iterates over an array in memory and xor its current values with a unique integer depending on the hmm function. For example hmm6 has unique value 8 and array at 0x10002F828

returns the result of the xor



## Boom (the actual instructions)



"m" : calls self hmmm; gets the two next values, (does nothing with them ???), calls woah_dst

moves the first value into the second one, second one is either an array [] or a register.

"h" : set self to completed

"c" : reads two next values; calls hmmm twice (wrong decompilation again), calls cc_rval


"jn" : and if the call to ef + 1 != 0.   reads the next value and Sets the instruction pointer,

"j" : reads next value and calls aaa:iw

"!!" : calls Good::go 

else checks if the char is one of the ALU operation. 

"\_" is probably a NOP



## Good go function

Reads value into register rs (not sure)

and matches on it


"!": 

"Y": call speculate with current location

"r": puts a random value into ra

"s": sleeps the amount of time specified in ra



## is_hmmmm 

checks if string[0] = '[' 
and string[-1] = ']'



## hmm

checks if value is register

if it is : looks into some array (probably register array and gets its value ?)


else : sends the integer value of the locstion


## woah:dst



