Skip to content

Instantly share code, notes, and snippets.

@mcveat
Last active August 2, 2017 17:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mcveat/a6054baf3269a7d563e9b7ccd6e2f37b to your computer and use it in GitHub Desktop.
Save mcveat/a6054baf3269a7d563e9b7ccd6e2f37b to your computer and use it in GitHub Desktop.
bob = eth.accounts[0]
abi = [{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"balanceOf","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"name":"transfer","outputs":[],"payable":false,"type":"function"},{"inputs":[{"name":"initialSupply","type":"uint256"}],"payable":false,"type":"constructor"}]
contract = eth.contract(abi)
code = "0x6060604052341561000f57600080fd5b604051602080610310833981016040528080519060200190919050505b806000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b505b61028f806100816000396000f30060606040526000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806370a0823114610049578063a9059cbb14610096575b600080fd5b341561005457600080fd5b610080600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506100d8565b6040518082815260200191505060405180910390f35b34156100a157600080fd5b6100d6600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919050506100f0565b005b60006020528060005260406000206000915090505481565b806000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101561013b57600080fd5b6000808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020540110156101c657600080fd5b806000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540392505081905550806000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055505b50505600a165627a7a72305820b1e8c908d9cdc4837ab94f73527a626af9fd9ef444d7874c1bd2f43ec35a70a80029"
personal.unlockAccount(bob, "bobs password")
contractInstance = contract.new(1000, {data: code, from: bob, gas: 1000000})
miner.start(1)
admin.sleepBlocks(2) // halts script execution until 2 blocks are mined
miner.stop()
receipt = eth.getTransactionReceipt(contractInstance.transactionHash)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment