Skip to content

Instantly share code, notes, and snippets.

@thebalaa
Created February 16, 2017 18:25
Show Gist options
  • Save thebalaa/72fca753d725a4d5bf5bd2cf12df08b5 to your computer and use it in GitHub Desktop.
Save thebalaa/72fca753d725a4d5bf5bd2cf12df08b5 to your computer and use it in GitHub Desktop.
# create an account and unlock it
web3.personal.newAccount('password')
web3.personal.unlockAccount(web3.eth.accounts[0], 'password')
# load bytcode and abi from local file
bytecode = open('provenanve.bytcode', 'r').read()
abi = open('provenanve.abi', 'r').read()
# instantiate and deploy contract
contract = web3.eth.contract(abi, bytecode=bytecode)
contract.deploy(transaction={"from":web3.eth.accounts[0]})
# re-instantiate contract with address
contract = web3.eth.contract(contract_name='provenance', abi=abi, address='0xaD82D4a32a7A066C0971234412ab4b01bd130FB3')
# call create data
contract.transact({"from":web3.eth.accounts[0]}).createData('0xaD82D4a32a7A066C0971234412ab4b01bd130FB3','0xaD82D4a32a7A066C0971234412ab4b01bd130FB3')
@geekybot
Copy link

geekybot commented Aug 3, 2017

Hi, after line 11, how do I get the deployed contract address??

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment