-
Hello, Here's my code:import json
from solcx import compile_standard, install_solc
with open("./SimpleStorage.sol", "r") as file:
simple_storage_file = file.read()
print("Installing...")
install_solc("0.6.0")
compiled_sol = compile_standard(
{
"language": "solidity",
"sources": {"SimpleStorage.sol": {"content": simple_storage_file}},
"settings": {
"outputSelection": {
"*": {
"*": ["abi", "metadata", "evm.bytecode", "evm.bytecode.sourceMap"]
}
}
},
},
solc_version="0.6.0",
)
with open("compiled_code.json", "w") as file:
json.dump(compiled_sol, file)
bytecode = compiled_sol["contracts"]["SimpleStorage.sol"]["SimpleStorage"]["evm"][
"bytecode"
]["object"]
abi = json.loads(
compiled_sol["contracts"]["SimpleStorage.sol"]["SimpleStorage"]["metadata"]
)["output"]["abi"]
print(compiled_sol)
Here's the error that shows up:
|
Beta Was this translation helpful? Give feedback.
Answered by
cromewar
Jun 14, 2022
Replies: 1 comment 5 replies
-
Hello @taaha161 I highly recommend you to use another python version, the best one ins Python 3.8, also use an isolated virtual env for for python smart contracts. I hope this info might help. |
Beta Was this translation helpful? Give feedback.
5 replies
Answer selected by
cromewar
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello @taaha161
Seems you python is having problems downloading Solc-x
I highly recommend you to use another python version, the best one ins Python 3.8, also use an isolated virtual env for for python smart contracts.
I hope this info might help.