I have created a smart contract and deployed it on ropsten with brownie framework.
Here are the steps I've done:
Run the command:
$ brownie init projet1
I have created my contract in contracts/Contrat1.vy file
I have run:
$ brownie compile
I have created an Ethereum account and I've sent some ether on it:
$ brownie accounts generate mon_account2
I have created this file for deployment: scripts/deploiement.py:
from brownie import Contrat1, accounts def main(): compte = accounts.load('mon_account2') t = Contrat1.deploy({'from': compte})
I have created a project on infura and I've got a project id
I have created an account and an API TOKEN KEY on etherscan
I have run:
$ export WEB3_INFURA_PROJECT_ID=<my_infura_projectid> $ export ETHERSCAN_TOKEN=<my_etherscan_api_token_key>
I have run:
$ brownie run deploiement --network ropsten
At this step, my contract is deployed on ropsten. Its deployment address is displayed on screen.
Now I want to interact with this contract. So I have run:
$ brownie console --network ropsten provider = Contract.from_explorer('<my_contract's_deployment_address>')
I suppose I can now send transactions through provider variable.
Here are my questions:
- My infura secret was not asked. So I suppose anyone can call my infura project url ?
- Is there a way to avoid to work with Etherscan ? I have worked previously with truffle and it was not necessary to get an Etherscan account for deploying contract.
- Is there a way to avoid to export WEB3_INFURA_PROJECT_ID and ETHERSCAN_TOKEN ? Is there a way to put these values in a project configuration file ?
- When launching Contract.from_explorer, I get this error:
ValueError: Failed to retrieve data from API: Contract source code not verified
How should I fix that?
Thanks a lot
wget
can help (orcurl
) : etherscan.io/sourcecode-demo.htmlCall()