[This might be] an error regarding HTTPProvider not connecting to the "https://ropsten.etherscan.io"
That's correct, you cannot use the etherscan.io API as a JSON-RPC server.
Instead, I'd recommend running an Ethereum node locally that is synced with Ropsten, similar to how (I presume) you ran the private testnet.
One way to do that would be:
parity --chain ropsten
You can then connect with:
from web3 import Web3, HTTPProvider
web3 = Web3(HTTPProvider("http://localhost:8545"))
assert web3.isConnected()
Naturally, you'll need to create an account before the balanceOf()
call will work. For the transfer()
function to work, you'll also need to send the account ropsten ether.
API Comparison
Let's look at how each API sends the latest block number.
Etherscan
To get the current block number with the etherscan.io API, you would use a GET call, specifying eth_blockNumber
as the action
parameter.
eth_blockNumber
Returns the number of most recent block
https://ropsten.etherscan.io/api?module=proxy&action=eth_blockNumber&apikey=YourApiKeyToken
like so:
curl "https://ropsten.etherscan.io/api?module=proxy&action=eth_blockNumber"
Ethereum JSON-RPC server
In contrast, JSON-RPC specifies the API as a POST call, with eth_blockNumber
sent as the method
parameter, like so:
// Request
curl -X POST --data '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":83}'
// Result
{
"id":83,
"jsonrpc": "2.0",
"result": "0x4b7" // 1207
}
Best Answer
In that contract https://ropsten.etherscan.io/address/0x722dd3f80bac40c951b51bdd28dd19d435762180#code you need to call the function
showMeTheMoney
with your address and amount of tokens. It should deposit that amount in your address.