vyperlang / vyper

Pythonic Smart Contract Language for the EVM
https://vyperlang.org
Other
4.84k stars 788 forks source link

Unable to deploy Vyper contract to Ethereum TestRPC (Ganache CLI) #784

Closed ltfschoen closed 6 years ago

ltfschoen commented 6 years ago

What's your issue about?

I created this Python script https://github.com/ltfschoen/vyper-test/blob/master/scripts/main.py, which is a mixture of code that I created after reviewing the vyper repo, but ultimately uses Web3.py to try to deploy a Vyper contract to Ganache CLI (which I have running on localhost:8545). It runs successfully up to the .deploy line of code and then it hangs, but doesn't show any error message in the terminal, and I do not see any transaction in the Ganache CLI terminal:

...
tx_hash = contract_instance_web3.deploy(transaction={'from': web3.eth.accounts[0], 'gas': 410000})
print("Deployed Contract Tx Hash: %s", tx_hash)
...

I started Ganache CLI with the following command in a separate terminal window:

ganache-cli \
    --account="0x0000000000000000000000000000000000000000000000000000000000000001, 2471238800000000000" \
    --account="0x0000000000000000000000000000000000000000000000000000000000000002, 4471238800000000000" \
    --unlock "0x0000000000000000000000000000000000000000000000000000000000000001" \
    --unlock "0x0000000000000000000000000000000000000000000000000000000000000002" \
    --blocktime 0 \
    --deterministic true \
    --port 8545 \
    --hostname localhost \
    --seed 'blah' \
    --debug true \
    --mem true \
    --mnemonic 'something' \
    --db './db/chain_database' \
    --verbose \
    --networkId=3 \
    --gasLimit=7984452 \
    --gasPrice=20000000000;

Please include information like:

How can it be fixed?

Try using my code by following these instructions to https://github.com/ltfschoen/vyper-test#chapter-0---setup-without-docker-

Ideally a link to instructions or an example of how to deploy a Vyper smart contract to TestRPC, Ganache CLI, Ropsten, Rinkeby, or Mainnet would be great.

Cute Animal Picture


* L__ ___| U ****V****

fubuloubu commented 6 years ago

You get bytecode/abi and load it into contract_instance_web3, right?

This means the problem is with web3 -> ganache

ltfschoen commented 6 years ago

Thanks. I'll try using web3.py and Geth instead similar to how I did it here for Solidity but for Vyper instead https://github.com/ltfschoen/geth-node/blob/master/scripts/main.py

fubuloubu commented 6 years ago

It would be really cool to get it working for ganache and truffle. If you can copy how it currently does solc -> ganache and expand that so it leverages vyper in the same way, we should be in business.

I don't think it uses web3py for that. You don't have to use python to work with vyper, the compiler binary will work just as well as solc can (and if it doesn't we can add compiler flags and output options)

ltfschoen commented 6 years ago

I've made changes to the web3.py script https://github.com/ltfschoen/vyper-test/blob/master/scripts/main.py and updated its README https://github.com/ltfschoen/vyper-test/#chapter-0---setup-without-docker- to show how to successfully deploy a Vyper contract to a Private Network using Geth, and view the transaction in the Geth logs

ltfschoen commented 6 years ago

@fubuloubu I got it to deploy the Vyper contract to Truffle’s built-in blockchain in my repo https://github.com/ltfschoen/vyper-test. All you have to do is run truffle develop --log to start the blockchain http://truffleframework.com/docs/getting_started/client#truffle-develop, and then run my script and it deploys and you can interact with it.

jacqueswww commented 6 years ago

Closing, but placing vyper-test repo/chapters on our resource page.

Thanks! :smile_cat: