Being somewhat new to Javascript, that's what I tried initially. But that will cause "ReferenceError: bitcoin is not defined", so I used this approach instead. I don't know if this is the idiomatic way of doing it.