patrickalphac / nft-mix Goto Github PK
View Code? Open in Web Editor NEWLicense: MIT License
License: MIT License
Hi,
I tried to run 'scripts/advanced_collectible/create_collectible.py'
but got this error. Kindly help:
Running 'scripts/advanced_collectible/create_collectible.py::main'...
File "brownie/_cli/run.py", line 49, in main
return_value, frame = run(
File "brownie/project/scripts.py", line 103, in run
return_value = f_locals[method_name](*args, **kwargs)
File "./scripts/advanced_collectible/create_collectible.py", line 11, in main
transaction = advanced_collectible.createCollectible(
File "brownie/network/contract.py", line 1692, in call
return self.transact(*args)
File "brownie/network/contract.py", line 1565, in transact
return tx["from"].transfer(
File "brownie/network/account.py", line 642, in transfer
receipt, exc = self._make_transaction(
File "brownie/network/account.py", line 725, in _make_transaction
raise VirtualMachineError(e) from None
File "brownie/exceptions.py", line 121, in init
raise ValueError(str(exc)) from None
ValueError: Gas estimation failed: 'execution reverted'. This transaction will likely revert. If you wish to broadcast, you must set the gas limit manually.
My question where should I set the gas limit properly?
create_collectible.py
`from brownie import AdvancedCollectible, accounts, config
from scripts.helpful_scripts import get_oubreed
import time
STATIC_SEED = 123
def main():
dev = accounts.add(config['wallets']['from_key'])
advanced_collectible = AdvancedCollectible[len(AdvancedCollectible) - 1]
transaction = advanced_collectible.createCollectible(
STATIC_SEED, "None", {"from": dev})
transaction.wait(1)
requestId = transaction.events['requestedCollectible']['requesId']
token_id = advance_collectible.requestIdToTokenId(requestId)
time.sleep(45)
oubreed = get_oubreed(advanced_collectible.tokenIdToBreed(token_Id))
print('breed of tokenId {} is {}'.format(token_id, oubreed))`
oubreed is correct as I modified as it is.
brownie-config.yaml
`dependencies:
networks:
default: development
rinkeby:
vrf_coordinator: "0xb3dCcb4Cf7a26f6cf6B120Cf5A73875B7BBc655B"
link_token: "0x01be23585060835e02b77ef475b0cc51aa1e0709"
keyhash: "0x2ed0feb3e7fd2022120aa84fab1945545a9f2ffc9076fd6156fa96eaff4c1311"
fee: 100000000000000000`
thanks
nathan@nathan-VirtualBox:~/Documents/coding/nft/PatrickAlphaC/nftAttempt2/nft$ brownie run scripts/simple_collectible/create_collectible.py --network rinkeby
Brownie v1.14.6 - Python development framework for Ethereum
NftProject is the active project.
File "brownie/_cli/run.py", line 49, in main
return_value, frame = run(
File "brownie/project/scripts.py", line 53, in run
module = _import_from_path(script)
File "brownie/project/scripts.py", line 149, in _import_from_path
_import_cache[import_str] = importlib.import_module(import_str)
File "/usr/lib/python3.8/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen, line line, in in
File "<frozen, line line, in in
File "<frozen, line line, in in
File "<frozen, line line, in in
File "<frozen, line line, in in
File "<frozen, line line, in in
File "./scripts/simple_collectible/create_collectible.py", line 3, in <module>
from scripts.helpful_scripts import OPENSEA_FORMAT
ImportError: cannot import name 'OPENSEA_FORMAT' from 'scripts.helpful_scripts' (/home/nathan/Documents/coding/nft/PatrickAlphaC/nftAttempt2/nft/scripts/helpful_scripts.py)
I was looking at the code and the import error doesn't really make sense to me as in scripts.helpful_scripts there is not OPENSEA_FORMAT as that was replaced with OPENSEA_URL in the most recent push so create_collectable.py (within simple collectable) needs to be refactored to line 3 --> from scripts.helpful_scripts import OPENSEA_URL
also on line 16 same file
Hi, when I run this command on my cloud vm:
brownie run scripts/simple_collectible/deploy_simple.py --network rinkeby
or deploy advanced, both show
File "/usr/local/lib/python3.6/site-packages/urllib3/connection.py", line 182, in _new_conn
self, "Failed to establish a new connection: %s" % e
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPSConnection object at 0x7fc6c0e164e0>: Failed to establish a new connection: [Errno 113] No route to host
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='api-rinkeby.etherscan.io', port=443): Max retries exceeded with url: /api?module=contract&action=getsourcecode&address=0xae9474E9b5cA8D912B00D105A8d1b4f3236B33c8 (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7fc6c0e164e0>: Failed to establish a new connection: [Errno 113] No route to host',))
which implies the request url should be: http://api-rinkeby.etherscan.io/api?module=contract&action=getsourcecode&address=0xae9474E9b5cA8D912B00D105A8d1b4f3236B33c8
However my browser can get this url and return status 200.
What's the problem here? thx
After running:
brownie run scripts/simple_collectible/deploy_simple.py --network rinkeby
I run into this problem:
"Downloaded binary would not execute, or returned unexpected output. If this issue persists, you can try to compile from source code using solcx.compile_solc('0.4.26')
."
Hello, thanks for this repository, I'm currently learning by it but I found out the project uses a bit old versions of ChainLink and Solidity. I'm writing my own project rn with the latest Solidity compiler and have some issues so would be cool if this repo got updated to latest ChainLink / Solidity / OpenZeppelin
{
"name": "PUG",
"description": "An adorable SHIBA_INU pup!",
"image": "https://ipfs.io/ipfs/QmYx6GsYAKnNzZ9A6NvEKV9nf1VaDzJrqDR23Y8YSkebLU?filename=shiba-inu.png",
"attributes": [
{
"trait_type": "cuteness",
"value": 100
}
]
}
The name field value here should be SHIBA_INU, right?
solved it ... I forgot a definition of link_token ...
Just for testing I was tryig to create NFT using API calls calling an API for getting the random number:
The code is:
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
import "@chainlink/contracts/src/v0.6/ChainlinkClient.sol";
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
contract WeaponsCollectible is ERC721, ChainlinkClient {
uint256 public tokenCounter;
address public owner;
uint256 public per_collectible_price;
uint256 public total_funds_collected;
mapping (bytes32 => address) public requestIdToSender;
mapping (address => bool) public usedAirDrop; // Every account is eligible for 1 free collectible
mapping (bytes32 => string) public requestIdToTokenURI;
mapping (uint256 => Weapon) public tokenIdToWeapon;
mapping (bytes32 => uint256) public requestIdToTokenId;
// mapping (IERC20 => uint256) public whitelistedTokens;
address private oracle;
bytes32 private jobId;
uint256 private fee;
enum WeaponType { Revolver, AssaultRifle }
event ownershipTransferedTo(address indexed new_owner);
event requestedAirDrop(bytes32 indexed requestId);
event requestedCollectible(bytes32 indexed requestId);
event chainlinkReplied();
event commissionChanged(uint256 new_commission);
// event newTokenWhitelisted(IERC20 indexed token, uint256 indexed per_collectible_price);
struct Weapon {
WeaponType weaponType;
uint256 damage;
}
constructor(
address _oracle,
string memory _jobId,
uint256 _fee,
address _link
)
public
ERC721("Survival Weapon","WEAPON") {
if(_link == address(0)) {
setPublicChainlinkToken();
} else {
setChainlinkToken(_link);
}
owner = msg.sender;
oracle = _oracle;
jobId = stringToBytes32(_jobId);
fee = _fee;
per_collectible_price = 0;
}
function transferOwnership(address new_owner) public {
require(owner == msg.sender, "Only present owner can transfer the ownership");
owner = new_owner;
emit ownershipTransferedTo(new_owner);
}
function changeCommission(uint256 new_commission) public {
require(msg.sender == owner, "Only owner can change the commission");
per_collectible_price = new_commission;
emit commissionChanged(new_commission);
}
function withdrawCollection(address payable benificiary, uint256 amount) public {
require(owner == msg.sender, "Only owner can withdraw");
require(amount <= total_funds_collected, "Withdraw amount greater than total_funds_collected");
benificiary.transfer(amount);
}
// function whitelistToken(IERC20 token, uint256 per_collectible_price) public {
// require(owner == msg.sender);
// whitelistedTokens[token] = per_collectible_price;
// emit newTokenWhitelisted(token, per_collectible_price);
// }
function requestAirDrop(string memory tokenURI) public returns (bytes32) {
// Check if eligible for airdrop
require(
usedAirDrop[msg.sender] != true
);
Chainlink.Request memory request = buildChainlinkRequest(jobId, address(this), this.fulfill.selector);
// Set the URL to perform the GET request on
request.add("get","http://www.randomnumberapi.com/api/v1.0/random");
request.add("path","");
request.addInt("times",1);
// Send the request
bytes32 requestId = sendChainlinkRequestTo(oracle, request, fee);
requestIdToSender[requestId] = msg.sender;
usedAirDrop[msg.sender] = true;
requestIdToTokenURI[requestId] = tokenURI;
emit requestedAirDrop(requestId);
return requestId;
}
function createCollectible(string memory tokenURI) public payable returns (bytes32) {
// Take payment
if(per_collectible_price > 0) {
require(
msg.value > 0,
"Must pay the price of each token"
);
require(
msg.value % per_collectible_price == 0,
"Must pay a multiple of per collectible price"
);
}
total_funds_collected += msg.value;
Chainlink.Request memory request = buildChainlinkRequest(jobId, address(this), this.fulfill.selector);
// Set the URL to perform the GET request on
request.add("get","http://www.randomnumberapi.com/api/v1.0/random");
request.add("path","");
request.addInt("times",1);
// Send the request
bytes32 requestId = sendChainlinkRequestTo(oracle, request, fee);
requestIdToSender[requestId] = msg.sender;
requestIdToTokenURI[requestId] = tokenURI;
emit requestedCollectible(requestId);
return requestId;
}
function fulfill(bytes32 requestId, uint256 randomNumber) public recordChainlinkFulfillment(requestId) {
emit chainlinkReplied();
address collectibleOwner = requestIdToSender[requestId];
string memory tokenURI = requestIdToTokenURI[requestId];
uint256 newTokenId = tokenCounter;
_safeMint(collectibleOwner, newTokenId);
_setTokenURI(newTokenId, tokenURI);
WeaponType gunType = WeaponType(randomNumber%2);
uint256 minPower;
if(gunType == WeaponType.AssaultRifle)
minPower = 50;
else if(gunType == WeaponType.Revolver)
minPower = 10;
Weapon memory weapon = Weapon(gunType, minPower + (randomNumber%50)); // Power varies in range of 50
tokenIdToWeapon[newTokenId] = weapon;
requestIdToTokenId[requestId] = newTokenId;
tokenCounter+=1;
}
function setTokenURI(uint256 tokenId, string memory tokenURI) public {
require(
_isApprovedOrOwner(_msgSender(), tokenId),
"ERC721: transfer caller is not owner nor approved"
);
_setTokenURI(tokenId, tokenURI);
}
function stringToBytes32(string memory source) public pure returns (bytes32 result) {
bytes memory tempEmptyStringTest = bytes(source);
if(tempEmptyStringTest.length == 0) {
return 0x0;
}
assembly {
result := mload(add(source, 32))
}
}
}
After deploying to rinkeby (used the parameters from brownie-config.yml file), when the functions are called, the API call is not executed by chainlink oracle
deployed at: 0xe5eeeEB3C9536CeFf0Eba3828177b4C5E1DA3303 (Rinkeby)
PS: I made sure that the contract is funded with link tokens
I get the exact error on windows, ubuntu (via console from microsoft store) and even ubuntu via a virtual machine:
does anyone know what i'm doing wrong?
nathan@nathan-VirtualBox:~/Documents/coding/nft/PatrickAlphaC/nft$ brownie run scripts/simple_collectible/deploy_simple.py --network rinkeby
Brownie v1.14.6 - Python development framework for Ethereum
Compiling contracts...
Solc version: 0.6.6
Optimizer: Enabled Runs: 200
EVM Version: Istanbul
Generating build data...
- OpenZeppelin/[email protected]/ERC165
- OpenZeppelin/[email protected]/IERC165
- OpenZeppelin/[email protected]/SafeMath
- OpenZeppelin/[email protected]/ERC721
- OpenZeppelin/[email protected]/IERC721
- OpenZeppelin/[email protected]/IERC721Enumerable
- OpenZeppelin/[email protected]/IERC721Metadata
- OpenZeppelin/[email protected]/IERC721Receiver
- OpenZeppelin/[email protected]/Address
- OpenZeppelin/[email protected]/Context
- OpenZeppelin/[email protected]/EnumerableMap
- OpenZeppelin/[email protected]/EnumerableSet
- OpenZeppelin/[email protected]/Strings
- smartcontractkit/[email protected]/VRFConsumerBase
- smartcontractkit/[email protected]/VRFRequestIDBase
- smartcontractkit/[email protected]/LinkTokenInterface
- smartcontractkit/[email protected]/SafeMathChainlink
- AdvancedCollectible
- SimpleCollectible
- VRFCoordinatorMock
Compiling contracts...
Solc version: 0.6.12
Optimizer: Enabled Runs: 200
EVM Version: Istanbul
Generating build data...
- smartcontractkit/[email protected]/LinkTokenReceiver
- smartcontractkit/[email protected]/AggregatorInterface
- smartcontractkit/[email protected]/AggregatorV2V3Interface
- smartcontractkit/[email protected]/AggregatorV3Interface
- smartcontractkit/[email protected]/ChainlinkRequestInterface
- smartcontractkit/[email protected]/LinkTokenInterface
- smartcontractkit/[email protected]/SafeMathChainlink
- MockOracle
- MockV3Aggregator
Compiling contracts...
Solc version: 0.4.26
Optimizer: Enabled Runs: 200
EVM Version: Byzantium
Generating build data...
- smartcontractkit/[email protected]/ERC677Token
- smartcontractkit/[email protected]/ERC20
- smartcontractkit/[email protected]/ERC20Basic
- smartcontractkit/[email protected]/ERC677
- smartcontractkit/[email protected]/ERC677Receiver
- smartcontractkit/[email protected]/BasicToken
- smartcontractkit/[email protected]/SafeMathChainlink
- smartcontractkit/[email protected]/StandardToken
- LinkToken
Generating interface ABIs...
NftProject is the active project.
Running 'scripts/simple_collectible/deploy_simple.py::main'...
File "brownie/_cli/run.py", line 49, in main
return_value, frame = run(
File "brownie/project/scripts.py", line 103, in run
return_value = f_locals[method_name](*args, **kwargs)
File "./scripts/simple_collectible/deploy_simple.py", line 10, in main
dev = accounts.add(config["wallets"]["from_key"])
File "brownie/network/account.py", line 132, in add
w3account = web3.eth.account.from_key(private_key)
File "eth_utils/decorators.py", line 18, in _wrapper
return self.method(obj, *args, **kwargs)
File "eth_account/account.py", line 246, in from_key
key = self._parsePrivateKey(private_key)
File "eth_utils/decorators.py", line 18, in _wrapper
return self.method(obj, *args, **kwargs)
File "eth_account/account.py", line 694, in _parsePrivateKey
return self._keys.PrivateKey(HexBytes(key))
File "hexbytes/main.py", line 23, in __new__
bytesval = to_bytes(val)
File "hexbytes/_utils.py", line 17, in to_bytes
return hexstr_to_bytes(val)
File "hexbytes/_utils.py", line 50, in hexstr_to_bytes
return binascii.unhexlify(ascii_hex)
Error: Non-hexadecimal digit found
Hello,
I've been trying to do the most basic of things, download the git repo and deploy the simple NFT according to the tutorial. I get the following error message:
Brownie v1.13.3 - Python development framework for Ethereum
NftMixProject is the active project.
Launching 'ganache-cli --port 8545 --gasLimit 12000000 --accounts 10 --hardfork istanbul --mnemonic brownie'...
Running 'scripts/simple_collectible/deploy_simple.py::main'...
mnemonic: 'steak unhappy joke dune invite relax candy update agent vacuum bone ignore'
development
File "brownie/_cli/run.py", line 49, in main
return_value, frame = run(
File "brownie/project/scripts.py", line 96, in run
return_value = f_locals[method_name](*args, **kwargs)
File "", line 4, in main
File "brownie/network/contract.py", line 158, in getitem
return self._contracts[i]
IndexError: list index out of range
Terminating local RPC client...
I got the same issue trying to run with sudo, nothing works.
'invalid opcode: opcode 0xfe not defined'. This transaction will likely revert. If you wish to broadcast, you must set the gas limit manually.
On Deploying Advanced Smart Contract
I have not enabled Etherscan API
Running setup.py install for bitarray ... error
ERROR: Command errored out with exit status 1:
command: 'C:\Users\John\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\John\\AppData\\Local\\Temp\\pip-install-z7al522m\\bitarray_c56a30c2fa0c402d9e766c464a07a8f5\\setup.py'"'"'; __file__='"'"'C:\\Users\\John\\AppData\\Local\\Temp\\pip-install-z7al522m\\bitarray_c56a30c2fa0c402d9e766c464a07a8f5\\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\John\AppData\Local\Temp\pip-record-q10h_0p_\install-record.txt' --single-version-externally-managed --user --prefix= --compile --install-headers 'C:\Users\John\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\Include\bitarray'
cwd: C:\Users\John\AppData\Local\Temp\pip-install-z7al522m\bitarray_c56a30c2fa0c402d9e766c464a07a8f5\
Complete output (19 lines):
running install
running build
running build_py
creating build
creating build\lib.win-amd64-3.9
creating build\lib.win-amd64-3.9\bitarray
copying bitarray\test_bitarray.py -> build\lib.win-amd64-3.9\bitarray
copying bitarray\test_util.py -> build\lib.win-amd64-3.9\bitarray
copying bitarray\util.py -> build\lib.win-amd64-3.9\bitarray
copying bitarray\__init__.py -> build\lib.win-amd64-3.9\bitarray
running build_ext
building 'bitarray._bitarray' extension
creating build\temp.win-amd64-3.9
creating build\temp.win-amd64-3.9\Release
creating build\temp.win-amd64-3.9\Release\bitarray
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.25.28610\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -IC:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.2032.0_x64__qbz5n2kfra8p0\include -IC:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.2032.0_x64__qbz5n2kfra8p0\include -IC:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.25.28610\include /Tcbitarray/_bitarray.c /Fobuild\temp.win-amd64-3.9\Release\bitarray/_bitarray.obj
_bitarray.c
C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.2032.0_x64__qbz5n2kfra8p0\include\pyconfig.h(59): fatal error C1083: Cannot open include file: 'io.h': No such file or directory
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.25.28610\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2
----------------------------------------
ERROR: Command errored out with exit status 1: 'C:\Users\John\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\python.exe'
-u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\John\\AppData\\Local\\Temp\\pip-install-z7al522m\\bitarray_c56a30c2fa0c402d9e766c464a07a8f5\\setup.py'"'"'; __file__='"'"'C:\\Users\\John\\AppData\\Local\\Temp\\pip-install-z7al522m\\bitarray_c56a30c2fa0c402d9e766c464a07a8f5\\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__,
'"'"'exec'"'"'))' install --record 'C:\Users\John\AppData\Local\Temp\pip-record-q10h_0p_\install-record.txt' --single-version-externally-managed --user --prefix= --compile --install-headers 'C:\Users\John\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\Include\bitarray' Check the logs for full command output.
Hi,
When i run this command i get the following issues Any reason?
"brownie run scripts/simple_collectible/create_collectible.py"
but I have executed following command successfully and deployed without error
"brownie run scripts/simple_collectible/deploy_simple.py"
Error
File "brownie/_cli/run.py", line 50, in main
args[""], method_name=args[""] or "main", _include_frame=True
File "brownie/project/scripts.py", line 103, in run
return_value = f_locals[method_name](*args, **kwargs)
File "./scripts/simple_collectible/create_collectible.py", line 9, in main
simple_collectible = SimpleCollectible[len(SimpleCollectible) - 1]
File "brownie/network/contract.py", line 158, in getitem
return self._contracts[i]
IndexError: list index out of range
when I run this command, I get this error
brownie run scripts/simple_collectible/deploy_simple.py --network rinkeby
File "brownie/network/web3.py", line 171, in _expand_environment_vars
raise ValueError(f"Unable to expand environment variable in host setting: '{uri}'")
ValueError: Unable to expand environment variable in host setting: 'https://rinkeby.infura.io/v3/$WEB3_INFURA_PROJECT_ID
I have setup the WEB3_INFURA_PROJECT_ID and PRIVATE_KEY in .env file but got above issue
solc throws an error when brownie compiling.
import function per AdvancedCollectible.sol: (I use the .sol code and .yaml copies from github to rule out typos, but still the same)
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@chainlink/contracts/src/v0.6/VRFConsumerBase.sol";
According to the docs brownie should have ensured that all remapped paths are allowed. so there's no need to declare "allow_paths"
INFO: Could not find files for the given pattern(s).
Brownie v1.16.2 - Python development framework for Ethereum
Compiling contracts...
Solc version: 0.6.6
Optimizer: Enabled Runs: 200
EVM Version: Istanbul
CompilerError: solc returned the following errors:
contracts/AdvancedCollectibles.sol:3:1: ParserError: Source "OpenZeppelin/[email protected]/contracts/token/ERC721/ERC721.sol" not found: File outside of allowed directories.
import "OpenZeppelin/[email protected]/contracts/token/ERC721/ERC721.sol";
^-----------------------------------------------------------------------------------^
contracts/AdvancedCollectibles.sol:4:1: ParserError: Source "smartcontractkit/[email protected]/contracts/src/v0.6/VRFConsumerBase.sol" not found: File outside of allowed directories.
import "smartcontractkit/[email protected]/contracts/src/v0.6/VRFConsumerBase.sol";
^-------------------------------------------------------------------------------------------------^
I then tried to use the actual path instead of remaps as suggested from another user on stackexchange but no luck either.......any ideas?
import "OpenZeppelin/[email protected]/contracts/token/ERC721/ERC721.sol";
import "smartcontractkit/[email protected]/contracts/src/v0.6/VRFConsumerBase.sol";
Running 'scripts/advanced_collectible/create_collectible.py::main'...
File "brownie/_cli/run.py", line 49, in main
return_value, frame = run(
File "brownie/project/scripts.py", line 103, in run
return_value = f_locals[method_name](*args, **kwargs)
File "./scripts/advanced_collectible/create_collectible.py", line 9, in main
transaction = advanced_collectible.createCollectible("None", {"from":dev})
File "brownie/network/contract.py", line 1693, in __call__
return self.transact(*args)
File "brownie/network/contract.py", line 1566, in transact
return tx["from"].transfer(
File "brownie/network/account.py", line 642, in transfer
receipt, exc = self._make_transaction(
File "brownie/network/account.py", line 725, in _make_transaction
raise VirtualMachineError(e) from None
File "brownie/exceptions.py", line 121, in __init__
raise ValueError(str(exc)) from None
ValueError: Gas estimation failed: 'execution reverted'. This transaction will likely revert. If you wish to broadcast, you must set the gas limit manually.
This is the error I was getting and I went to check that my wallet was funded with ETH and it was.
Hello! I have a question regarding the transaction fee amount. Does it reflect real fee amount which I can expect on the Mainnet?
First, thank you for sharing your work. It helps me a lot.
I could run the simple deploy and collectible script but I got an error for the advanced_collectible scripts like below.
I ran this command
brownie run scripts/advanced_collectible/create_collectible.py --network ropsten
Brownie v1.16.0 - Python development framework for Ethereum
NftMixProject is the active project.
Running 'scripts/advanced_collectible/create_collectible.py::main'...
File "brownie/_cli/run.py", line 50, in main
args[""], method_name=args[""] or "main", _include_frame=True
File "brownie/project/scripts.py", line 103, in run
return_value = f_locals[method_name](*args, **kwargs)
File "./scripts/advanced_collectible/create_collectible.py", line 9, in main
advanced_collectible = AdvancedCollectible[len(AdvancedCollectible) - 1]
File "brownie/network/contract.py", line 160, in getitem
return self._contracts[i]
IndexError: list index out of range
Thank you,
After adding my private key and project id on .env file it's works perfectly yesterday but suddenly i got the an error "Gas estimation failed: 'invalid opcode: opcode 0xfe not defined'. This transaction will likely revert. If you wish to broadcast, you must set the gas limit manually." after running deploy file.
(brownie run scripts/advanced_collectible/deploy_advanced.py --network rinkeby)
Please Help me about error.
After git clone the nft-mx source, I tried to do deploy_advanced.py like this.
brownie run scripts/advanced_collectible/deploy_advanced.py --network rinkeby
After that, I got error such as:
Transaction sent: 0xf4595c971682aac51a0d8bd54799f2eb3f3d35e6b602bc4143b063eb6b0c6ae9
Gas price: 1.0 gwei Gas limit: 2547768 Nonce: 190
AdvancedCollectible.constructor confirmed - Block: 8732182 Gas used: 2316153 (90.91%)
AdvancedCollectible deployed at: 0xB8843A7f249f83BcA850b62a02052eDD836783b8
File "c:\python37\lib\site-packages\brownie_cli\run.py", line 50, in main
args[""], method_name=args[""] or "main", _include_frame=True
File "c:\python37\lib\site-packages\brownie\project\scripts.py", line 103, in run
return_value = f_locals[method_name](*args, **kwargs)
File "\study\NFTS\nft\scripts\advanced_collectible\deploy_advanced.py", line 18, in main
fund_advanced_collectible(advanced_collectible)
File ".\scripts\helpful_scripts.py", line 16, in fund_advanced_collectible
nft_contract, config["networks"][network.show_active()]["fee"], {"from": dev}
File "c:\python37\lib\site-packages\brownie\network\contract.py", line 1676, in call
return self.transact(*args)
File "c:\python37\lib\site-packages\brownie\network\contract.py", line 1559, in transact
allow_revert=tx["allow_revert"],
File "c:\python37\lib\site-packages\brownie\network\account.py", line 600, in transfer
gas_limit = Wei(gas_limit) or self._gas_limit(to, amount, gas_price, gas_buffer, data)
File "c:\python37\lib\site-packages\brownie\network\account.py", line 367, in _gas_limit
gas_limit = self.estimate_gas(to, amount, gas_price, data or "")
File "c:\python37\lib\site-packages\brownie\network\account.py", line 561, in estimate_gas
f"Gas estimation failed: '{msg}'. This transaction will likely revert. "
ValueError: Gas estimation failed: 'invalid opcode: opcode 0xfe not defined'. This transaction will likely revert. If you wish to broadcast, you must set the gas limit manually.
even if I changed gas fee, but I got a same errors.
Please I appreciate if you give me advise.
Thanks.
Running 'scripts/simple_collectible/deploy_simple.py::main'... rinkeby File "/usr/local/lib/python3.8/dist-packages/brownie/_cli/run.py", line 49, in main return_value, frame = run( File "/usr/local/lib/python3.8/dist-packages/brownie/project/scripts.py", line 103, in run return_value = f_locals[method_name](*args, **kwargs) File "./scripts/simple_collectible/deploy_simple.py", line 10, in main SimpleCollectible.deploy({"from": dev}, publish_source=publish_source) File "/usr/local/lib/python3.8/dist-packages/brownie/network/contract.py", line 600, in __call__ return tx["from"].deploy( File "/usr/local/lib/python3.8/dist-packages/brownie/network/account.py", line 508, in deploy receipt, exc = self._make_transaction( File "/usr/local/lib/python3.8/dist-packages/brownie/network/account.py", line 743, in _make_transaction exc = VirtualMachineError(e) File "/usr/local/lib/python3.8/dist-packages/brownie/exceptions.py", line 85, in __init__ raise ValueError(exc["message"]) from None ValueError: insufficient funds for gas * price + value
OS: macOS Big Sur 11.6
Brownie: v1.16.4
Python: 3.9.0 (also tried with 3.8.6)
Hi! When I run brownie run scripts/simple_collectible/deploy_simple.py --network rinkeby
, I got this:
Brownie v1.16.4 - Python development framework for Ethereum
Compiling contracts...
Solc version: 0.6.6
Optimizer: Enabled Runs: 200
EVM Version: Istanbul
Generating build data...
- OpenZeppelin/[email protected]/ERC165
- OpenZeppelin/[email protected]/IERC165
- OpenZeppelin/[email protected]/SafeMath
- OpenZeppelin/[email protected]/ERC721
- OpenZeppelin/[email protected]/IERC721
- OpenZeppelin/[email protected]/IERC721Enumerable
- OpenZeppelin/[email protected]/IERC721Metadata
- OpenZeppelin/[email protected]/IERC721Receiver
- OpenZeppelin/[email protected]/Address
- OpenZeppelin/[email protected]/Context
- OpenZeppelin/[email protected]/EnumerableMap
- OpenZeppelin/[email protected]/EnumerableSet
- OpenZeppelin/[email protected]/Strings
- smartcontractkit/[email protected]/VRFConsumerBase
- smartcontractkit/[email protected]/VRFRequestIDBase
- smartcontractkit/[email protected]/LinkTokenInterface
- smartcontractkit/[email protected]/SafeMathChainlink
- AdvancedCollectible
- SimpleCollectible
- VRFCoordinatorMock
Compiling contracts...
Solc version: 0.6.12
Optimizer: Enabled Runs: 200
EVM Version: Istanbul
Generating build data...
- smartcontractkit/[email protected]/LinkTokenReceiver
- smartcontractkit/[email protected]/AggregatorInterface
- smartcontractkit/[email protected]/AggregatorV2V3Interface
- smartcontractkit/[email protected]/AggregatorV3Interface
- smartcontractkit/[email protected]/ChainlinkRequestInterface
- smartcontractkit/[email protected]/LinkTokenInterface
- smartcontractkit/[email protected]/SafeMathChainlink
- MockOracle
- MockV3Aggregator
Compiling contracts...
Solc version: 0.4.26
Optimizer: Enabled Runs: 200
EVM Version: Byzantium
Generating build data...
- smartcontractkit/[email protected]/ERC677Token
- smartcontractkit/[email protected]/ERC20
- smartcontractkit/[email protected]/ERC20Basic
- smartcontractkit/[email protected]/ERC677
- smartcontractkit/[email protected]/ERC677Receiver
- smartcontractkit/[email protected]/BasicToken
- smartcontractkit/[email protected]/SafeMathChainlink
- smartcontractkit/[email protected]/StandardToken
- LinkToken
Generating interface ABIs...
NftProject is the active project.
File "brownie/_cli/run.py", line 49, in main
return_value, frame = run(
File "brownie/project/scripts.py", line 53, in run
module = _import_from_path(script)
File "brownie/project/scripts.py", line 149, in _import_from_path
_import_cache[import_str] = importlib.import_module(import_str)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen, line line, in in
File "<frozen, line line, in in
File "<frozen, line line, in in
File "<frozen, line line, in in
File "<frozen, line line, in in
File "<frozen, line line, in in
File "<frozen, line line, in in
File "<frozen, line line, in in
File "<frozen, line line, in in
File "<frozen, line line, in in
File "<frozen, line line, in in
File "<frozen, line line, in in
File "<frozen, line line, in in
File "<frozen, line line, in in
File "<frozen, line line, in in
File "<frozen, line line, in in
File "<frozen, line line, in in
File "<frozen, line line, in in
File "<frozen, line line, in in
File "<frozen, line line, in in
File "<frozen, line line, in in
File "<frozen, line line, in in
File "<frozen, line line, in in
File "<frozen, line line, in in
File "<frozen, line line, in in
File "<frozen, line line, in in
File "<frozen, line line, in in
ModuleNotFoundError: No module named 'Users.t'
Great project, but..
brownie bake nft-mix
ConnectionError: 404 error when attempting to download from https://github.com/brownie-mix/nft-mix/archive/master.zip - are you sure this is a valid mix? https://github.com/brownie-mix
Hi, I have some questions. @PatrickAlphaC
First, Why do we need to wait like 20min to see an NFT image through the opensea?
I think it should be fast because we already uploaded to IPFS and got an image URI from there.
and... I tried using different big-size images like 900kb (1024x1024) and I found that I couldn't see these images using the opensea even though I waited for one day.
However, it's possible to see low-size images similar to the puppy images' size.
It's very strange. I checked that json and uri are uploaded to ipfs correctly and I can see the json file and a uploaded image through my chrome browser. But I can't see the image through the opensea website.
Thank you.
Hello everybody.
I just would like to know how to deploy the simple contract on OpenSea main net ?
All is working on testnet.
Thank you
Hi, I am following the tutorial below:
https://www.freecodecamp.org/news/how-to-make-an-nft-and-render-on-opensea-marketplace/
Everything was running smoothly until I ran the following command:
brownie run scripts/simple_collectible/deploy_simple.py --network rinkeby
Here is the error message from the output:
Compiling contracts...
Solc version: 0.6.12
Optimizer: Enabled Runs: 200
EVM Version: Istanbul
CompilerError: solc returned the following errors:
contracts/test_contracts/mocks/MockOracle.sol:7:1: ParserError: Source "/Users/me/.brownie/packages/smartcontractkit/[email protected]/contracts/src/v0.6/vendor/SafeMath.sol" not found: File not found.
import "@chainlink/contracts/src/v0.6/vendor/SafeMath.sol";
^---------------------------------------------------------^
I tried moving forward with the next commands from the tutorial but got the same error. This was no surprise since there was no SafeMath.sol file in that directory as the error points out.
My next attempt was to download the SafeMath.sol file for v0.6. and manually place it in there. When I tried this, however, I got the following error:
Compiling contracts...
Solc version: 0.4.24
Optimizer: Enabled Runs: 200
EVM Version: Byzantium
CompilerError: solc returned the following errors:
contracts/test_contracts/Oracle.sol:4:1: ParserError: Source "/Users/me/.brownie/packages/smartcontractkit/[email protected]/contracts/src/v0.4/vendor/SafeMath.sol" not found: File not found.
import "@chainlink/contracts/src/v0.4/vendor/SafeMath.sol";
^---------------------------------------------------------^
Notice that the above error is exactly the same, but now it's trying to use version 0.4 which seems odd to me. It sounds like the SafeMath library has caused some Solidity issues in the past, and that is likely part of the reason for excluding it from v0.8 (https://soliditydeveloper.com/solidity-0.8). Could be unrelated since I'm using v0.6.12, but just wanted to mention it.
Any help would be appreciated, thanks!
I have uploaded tokens to the Rinkeby Blockchain and they work on Openseas but the video will not load on Rinkeby.rarible.com.
https://rinkeby.rarible.com/token/0x7a3ba87e3b49dd82f0774b8ead207db3e39c9134:30?tab=details
https://testnets.opensea.io/assets/0x7a3ba87e3b49dd82f0774b8ead207db3e39c9134/30
When running the command 'brownie run scripts/simple_collectible/deploy_simple.py --network rinkeby' it outputs this: 'INFO: Could not find files for the given pattern(s).' a bunch of pointers to the code and the actual error: 'HTTPError: 401 Client Error: Unauthorized for url: https://rinkeby.infura.io/v3/*the ID for my infura project*'. I appreciate anyone that can help, thanks ahead of time.
Also, I should mention I set the necessary PRIVATE_KEY environment variable from my wallet and the needed WEB3_INFURA_PROJECT_ID environment variable from a new and active Infura project.
I'm receiving this error:
Running 'scripts/simple_collectible/create_collectible.py::main'...
rinkeby
File "brownie/_cli/run.py", line 49, in main
return_value, frame = run(
File "brownie/project/scripts.py", line 103, in run
return_value = f_locals[method_name](*args, **kwargs)
File "./scripts/simple_collectible/create_collectible.py", line 13, in main
transaction = simple_collectible.createCollectible(sample_token_uri, {"from": dev})
File "brownie/network/contract.py", line 832, in __getattribute__
raise AttributeError(f"Contract '{self._name}' object has no attribute '{name}'")
AttributeError: Contract 'SimpleCollectible' object has no attribute 'createCollectible'
This is my SimpleCollectible.sol
file:
pragma solidity 0.6.6;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
contract SimpleCollectible is ERC721 {
uint256 public tokenCounter;
constructor () public ERC721 ("Dogie", "DOG"){
tokenCounter = 0;
}
function createCollectible(string memory tokenURI) public returns (uint256) {
uint256 newItemId = tokenCounter;
_safeMint(msg.sender, newItemId);
_setTokenURI(newItemId, tokenURI);
tokenCounter = tokenCounter + 1;
return newItemId;
}
}
I'm getting gas estimation failed (insufficient funds for transfer) error even though I have 200 LINK in my metamask wallet under rinkeby test network. What am I doing wrong here? ๐ญ
lucascheon@Lucass-MacBook-Pro nft % brownie run scripts/simple_collectible/deploy_simple.py --network rinkeby
Brownie v1.14.6 - Python development framework for Ethereum
NftProject is the active project.
Running 'scripts/simple_collectible/deploy_simple.py::main'...
rinkeby
File "brownie/_cli/run.py", line 49, in main
return_value, frame = run(
File "brownie/project/scripts.py", line 103, in run
return_value = f_locals[method_name](*args, **kwargs)
File "./scripts/simple_collectible/deploy_simple.py", line 13, in main
SimpleCollectible.deploy({"from": dev}, publish_source=publish_source)
File "brownie/network/contract.py", line 593, in __call__
return tx["from"].deploy(
File "brownie/network/account.py", line 465, in deploy
exc = VirtualMachineError(e)
File "brownie/exceptions.py", line 118, in __init__
raise ValueError(str(exc)) from None
ValueError: Gas estimation failed: 'insufficient funds for transfer'. This transaction will likely revert. If you wish to broadcast, you must set the gas limit manually.
I followed all steps from the video. When deploying create_collectible.py I receive the following error
kai@MBP-von-Kai nft-new % brownie run scripts/advanced_collectible/create_collectible.py --network rinkeby
Brownie v1.16.3 - Python development framework for Ethereum
NftNewProject is the active project.
Running 'scripts/advanced_collectible/create_collectible.py::main'...
Transaction sent: 0x94f070239adc0329991d534810760ebe66788cb5147da165cdbe35d24c43d459
Gas price: 1.000000009 gwei Gas limit: 178850 Nonce: 48
AdvancedCollectible.createCollectible confirmed Block: 9321866 Gas used: 157791 (88.23%)
AdvancedCollectible.createCollectible confirmed Block: 9321866 Gas used: 157791 (88.23%)
File "brownie/_cli/run.py", line 49, in main
return_value, frame = run(
File "brownie/project/scripts.py", line 103, in run
return_value = f_locals[method_name](*args, **kwargs)
File "./scripts/advanced_collectible/create_collectible.py", line 15, in main
breed = get_breed(advanced_collectible.tokenIdToBreed(token_id))
File "brownie/network/contract.py", line 832, in getattribute
raise AttributeError(f"Contract '{self._name}' object has no attribute '{name}'")
AttributeError: Contract 'AdvancedCollectible' object has no attribute 'tokenIdToBreed'
I'm sure this is an easy fix but I'm a total neophyte. When I try to deploy the simple collectible contract I get an error. It seems like there's an issue with solidity but I'm not sure. I would greatly appreciate some help figuring this out!
Downloading from https://solc-bin.ethereum.org/macosx-amd64/solc-macosx-amd64-v0.4.26+commit.4563c3fc
100%|โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ| 26.4M/26.4M [08:11<00:00, 53.8kiB/s]
dyld: lazy symbol binding failed: Symbol not found: ____chkstk_darwin
Referenced from: /Users/iantaylor/.solcx/solc-v0.4.26
Expected in: /usr/lib/libSystem.B.dylib
dyld: Symbol not found: ____chkstk_darwin
Referenced from: /Users/iantaylor/.solcx/solc-v0.4.26
Expected in: /usr/lib/libSystem.B.dylib
File "brownie/_cli/main.py", line 64, in main
importlib.import_module(f"brownie._cli.{cmd}").main()
File "brownie/_cli/run.py", line 39, in main
active_project = project.load()
File "brownie/project/main.py", line 745, in load
return Project(name, project_path)
File "brownie/project/main.py", line 180, in init
self.load()
File "brownie/project/main.py", line 235, in load
self._compile(changed, self._compiler_config, False)
File "brownie/project/main.py", line 92, in _compile
build_json = compiler.compile_and_format(
File "brownie/project/compiler/init.py", line 105, in compile_and_format
find_solc_versions(solc_sources, install_needed=True, silent=silent)
File "brownie/project/compiler/solidity.py", line 173, in find_solc_versions
install_solc(*to_install)
File "brownie/project/compiler/solidity.py", line 105, in install_solc
solcx.install_solc(version, show_progress=True)
File "solcx/install.py", line 466, in install_solc
raise exc
File "solcx/install.py", line 459, in install_solc
_validate_installation(version, solcx_binary_path)
File "solcx/install.py", line 636, in _validate_installation
raise SolcInstallationError(
SolcInstallationError: Downloaded binary would not execute, or returned unexpected output. If this issue persists, you can try to compile from source code using solcx.compile_solc('0.4.26')
Hello! So I have an issue that the API isn't printed at all if UPLOAD_IPFS & the URL is true (connected or not),
def write_metadata(number_of_tokens, nft_contract):
for token_id in range(number_of_tokens):
collectible_metadata = sample_metadata.metadata_template
breed = get_breed(nft_contract.tokenIdToBreed(token_id))
metadata_file_name = (
"./metadata/{}/".format(network.show_active()) + str(token_id) + "-" + breed + ".json"
)
if Path (metadata_file_name).exists():
print("{} already found!".format(metadata_file_name))
else:
print("Creating Metadata File: {}".format(metadata_file_name))
collectible_metadata["name"] = get_breed(
nft_contract.tokenIdToBreed(token_id))
collectible_metadata["description"] = "An adorable {} pup!".format(
collectible_metadata["name"])
print(collectible_metadata)
image_to_upload = None
if os.getenv("UPLOAD_IPFS") == "true":
image_path = "./img/{}.png".format(breed.lower().replace("_", "-"))
image_to_upload = upload_to_ipfs(image_path)
print(image_path)
def upload_to_ipfs(filepath):
with Path(filepath).open("rb") as fp:
image_binary = fp.read()
ipfs_url = "http://localhost:5001"
response = requests.post(ipfs_url + "/api/v0/add", files={"file": image_binary})
print(response.json())
ipfs_hash = response.json()["Hash"]
filename = filepath.split("/")[-1:][0]
image_uri = "http://ipfs.io/ipfs/{}?filename={}".format(ipfs_hash, filename)
print(uri)
return uri
return None
If I use the curl
command manually it worked
curl -X POST -F file=@img/pug.png http://localhost:5001/api/v0/add
{"Name":"pug.png","Hash":"QmSsYRx3LpDAb1GZQm7zZ1AuHZjfbPkD6J7s9r41xu1mf8","Size":"5699"}
But when I ran the Python, the results are shown below:
Brownie v1.14.4 - Python development framework for Ethereum
NftMixProject is the active project.
Running 'scripts/advanced_collectible/create_metadata.py::main'...
Working on rinkeby
The number of tokens you've deployed is 1
Creating Metadata File: ./metadata/rinkeby/0-PUG.json
{'name': 'PUG', 'description': 'An adorable PUG pup!', 'image': '', 'attributes': [{'trait_type': 'cuteness', 'value': 100}]}
It doesn't show the curl result, do I have to use the curl command manually so the other/next JSON (SHIBA_INU) will be shown? Thank you ๐
I'm coming into the following error when attempting the brownie bake nft-mix
command, any ideas why?
I'm running Ubuntu on WSL.
wardu@win:~$ brownie bake nft-mix
Brownie v1.16.4 - Python development framework for Ethereum
Downloading from https://github.com/brownie-mix/nft-mix/archive/main.zip...
46.8kiB [00:00, 812kiB/s]
File "brownie/_cli/__main__.py", line 64, in main
importlib.import_module(f"brownie._cli.{cmd}").main()
File "brownie/_cli/bake.py", line 26, in main
path = project.from_brownie_mix(args["<mix>"], args["<path>"], args["--force"])
File "brownie/project/main.py", line 617, in from_brownie_mix
project_path.parent.joinpath(f"{project_name}-mix-{default_branch}").rename(project_path)
File "/usr/lib/python3.8/pathlib.py", line 1359, in rename
self._accessor.rename(self, target)
PermissionError: [Errno 13] Permission denied: '/home/wardu/nft-mix-main' -> '/home/wardu/nft'
ValueError: Gas estimation failed: 'invalid opcode: opcode 0xfe not defined'. This transaction will likely revert. If you wish to broadcast, you must set the gas limit manually.
How does one set said gas limits?
Followed the exact steps in README but I get the following. Does anyone know what I'm doing wrong?
lucascheon@Lucass-MacBook-Pro nft % brownie run scripts/simple_collectible/create_collectible.py
Brownie v1.14.6 - Python development framework for Ethereum
NftProject is the active project.
Launching 'ganache-cli --port 8545 --gasLimit 12000000 --accounts 10 --hardfork istanbul --mnemonic brownie'...
Running 'scripts/simple_collectible/create_collectible.py::main'...
development
File "brownie/_cli/run.py", line 49, in main
return_value, frame = run(
File "brownie/project/scripts.py", line 103, in run
return_value = f_locals[method_name](*args, **kwargs)
File "./scripts/simple_collectible/create_collectible.py", line 11, in main
simple_collectible = SimpleCollectible[len(SimpleCollectible) - 1]
File "brownie/network/contract.py", line 158, in __getitem__
return self._contracts[i]
IndexError: list index out of range
Terminating local RPC client...
Whenever I try to run my script with this command:
'brownie run .\scripts\advanced_collectible\deploy_advanced.py',
I always get an error, I've tried multiple things to fix it and nothing seems to work.
ERROR:
ImportError: cannot import name 'AdvancedCollectible' from 'brownie' (C:\Python\Python39\lib\site-packages\brownie_init_.py)
I've got the latest version of brownie and python.
Recently whilst trying to fix it another problem popped up, not sure if it's going anything to do with it.
Hi,
I was wondering if there could be a version of the code without the dog randomization.
Thank you!
Hi, I was going through the simple_collectible tutorial
, and wanted to experiment with my own image of a ticket. I tried to modify the attributes with my own data in the file metadata/rinkeby/0-PUG.json
with the following
{
"name": "Ticket",
"description": "FirstTickett",
"image": "https://gateway.pinata.cloud/ipfs/IPFSCID",
"attributes": [
{
"trait_type": "Mistake",
"value": 100
}
]
}
changing the sample_token_uri ="https://gateway.pinata.clou/ipfs/IPFSCID" which stores the actual image of the ticket. Ialso defined a ERC simple collectible as follows
contract SimpleCollectible is ERC721 {
uint256 public tokenCounter;
constructor () public ERC721 ("Ticket", "TICKET"){
tokenCounter = 0;
}
I can successfully compile and run both the deploy scripts as mentioned in the README. However , I dont really get the image in opensea dashboard and also the description doesnt change. Is this not the right way of creating unique nfts . I could be perhaps totally wrong in my understanding .
Another question ,is that in terminal , I alaws see error messages even if it compiles and deploys. I wonder what is the reason. I understand it as a problem with linting of style . Screenshot below
hello, after run brownie run scripts/advanced_collectible/deploy_advanced.py --network rinkeby
, then output:
โฏ brownie run scripts/advanced_collectible/deploy_advanced.py --network rinkeby
Brownie v1.16.2 - Python development framework for Ethereum
NftProject is the active project.
Running 'scripts/advanced_collectible/deploy_advanced.py::main'...
rinkeby
Transaction sent: 0x5ab36042e6a5d79afc79953e36cde14dfa0f62b081a99217baab8489b489347c
Gas price: 1.000000014 gwei Gas limit: 2546712 Nonce: 8
AdvancedCollectible.constructor confirmed Block: 9210887 Gas used: 2315193 (90.91%)
AdvancedCollectible deployed at: 0x1197Ddf206B0953666C4DF0DC0056cb4b46A5ACA
Exception in thread Thread-3:
Traceback (most recent call last):
File "/home/haoran/.conda/envs/db/lib/python3.7/site-packages/urllib3/connection.py", line 170, in _new_conn
(self._dns_host, self.port), self.timeout, **extra_kw
File "/home/haoran/.conda/envs/db/lib/python3.7/site-packages/urllib3/util/connection.py", line 96, in create_connection
raise err
File "/home/haoran/.conda/envs/db/lib/python3.7/site-packages/urllib3/util/connection.py", line 86, in create_connection
sock.connect(sa)
TimeoutError: [Errno 110] Connection timed out
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/haoran/.conda/envs/db/lib/python3.7/site-packages/urllib3/connectionpool.py", line 706, in urlopen
chunked=chunked,
File "/home/haoran/.conda/envs/db/lib/python3.7/site-packages/urllib3/connectionpool.py", line 382, in _make_request
self._validate_conn(conn)
File "/home/haoran/.conda/envs/db/lib/python3.7/site-packages/urllib3/connectionpool.py", line 1010, in _validate_conn
conn.connect()
File "/home/haoran/.conda/envs/db/lib/python3.7/site-packages/urllib3/connection.py", line 353, in connect
conn = self._new_conn()
File "/home/haoran/.conda/envs/db/lib/python3.7/site-packages/urllib3/connection.py", line 182, in _new_conn
self, "Failed to establish a new connection: %s" % e
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPSConnection object at 0x7f18be0a93d0>: Failed to establish a new connection: [Errno 110] Connection timed out
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/haoran/.conda/envs/db/lib/python3.7/site-packages/requests/adapters.py", line 449, in send
timeout=timeout
File "/home/haoran/.conda/envs/db/lib/python3.7/site-packages/urllib3/connectionpool.py", line 756, in urlopen
method, url, error=e, _pool=self, _stacktrace=sys.exc_info()[2]
File "/home/haoran/.conda/envs/db/lib/python3.7/site-packages/urllib3/util/retry.py", line 574, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='api-rinkeby.etherscan.io', port=443): Max retries exceeded with url: /api?module=contract&action=getsourcecode&address=0x1197Ddf206B0953666C4DF0DC0056cb4b46A5ACA&apiKey=XPDQDKHGMINTAR1WNDAID5UCBGA141GGMS (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f18be0a93d0>: Failed to establish a new connection: [Errno 110] Connection timed out'))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/haoran/.conda/envs/db/lib/python3.7/threading.py", line 926, in _bootstrap_inner
self.run()
File "/home/haoran/.conda/envs/db/lib/python3.7/threading.py", line 870, in run
self._target(*self._args, **self._kwargs)
File "/home/haoran/.conda/envs/db/lib/python3.7/site-packages/brownie/network/contract.py", line 243, in _add_from_tx
self.at(tx.contract_address, tx.sender, tx)
File "/home/haoran/.conda/envs/db/lib/python3.7/site-packages/brownie/network/contract.py", line 217, in at
contract = _find_contract(address)
File "/home/haoran/.conda/envs/db/lib/python3.7/site-packages/brownie/network/state.py", line 557, in _find_contract
return Contract(address)
File "/home/haoran/.conda/envs/db/lib/python3.7/site-packages/brownie/network/contract.py", line 946, in __init__
contract = self.from_explorer(address, owner=owner, silent=True)
File "/home/haoran/.conda/envs/db/lib/python3.7/site-packages/brownie/network/contract.py", line 1097, in from_explorer
data = _fetch_from_explorer(address, "getsourcecode", silent)
File "/home/haoran/.conda/envs/db/lib/python3.7/site-packages/brownie/network/contract.py", line 1913, in _fetch_from_explorer
response = requests.get(url, params=params, headers=REQUEST_HEADERS)
File "/home/haoran/.conda/envs/db/lib/python3.7/site-packages/requests/api.py", line 75, in get
return request('get', url, params=params, **kwargs)
File "/home/haoran/.conda/envs/db/lib/python3.7/site-packages/requests/api.py", line 61, in request
return session.request(method=method, url=url, **kwargs)
File "/home/haoran/.conda/envs/db/lib/python3.7/site-packages/requests/sessions.py", line 542, in request
resp = self.send(prep, **send_kwargs)
File "/home/haoran/.conda/envs/db/lib/python3.7/site-packages/requests/sessions.py", line 655, in send
r = adapter.send(request, **kwargs)
File "/home/haoran/.conda/envs/db/lib/python3.7/site-packages/requests/adapters.py", line 516, in send
raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='api-rinkeby.etherscan.io', port=443): Max retries exceeded with url: /api?module=contract&action=getsourcecode&address=0x1197Ddf206B0953666C4DF0DC0056cb4b46A5ACA&apiKey=XPDQDKHGMINTAR1WNDAID5UCBGA141GGMS (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f18be0a93d0>: Failed to establish a new connection: [Errno 110] Connection timed out'))
I tried many times, but still not work, I do really edited and source .env
before run deploy, export my PRIVATE_KEY
and WEB3_INFURA_PROJECT_ID
.
I configured as explained in tutorial, I create a wallet on metamask and added 10 LINK in rinkeby but once I run:
brownie run scripts/simple_collectible/deploy_simple.py --network rinkeby
I have follow error:
Running 'scripts/simple_collectible/deploy_simple.py::main'...
rinkeby
File "brownie/_cli/run.py", line 49, in main
return_value, frame = run(
File "brownie/project/scripts.py", line 103, in run
return_value = f_locals[method_name](*args, **kwargs)
File "./scripts/simple_collectible/deploy_simple.py", line 10, in main
SimpleCollectible.deploy({"from": dev}, publish_source=publish_source)
File "brownie/network/contract.py", line 600, in call
return tx["from"].deploy(
File "brownie/network/account.py", line 508, in deploy
receipt, exc = self._make_transaction(
File "brownie/network/account.py", line 743, in _make_transaction
exc = VirtualMachineError(e)
File "brownie/exceptions.py", line 85, in init
raise ValueError(exc["message"]) from None
ValueError: insufficient funds for gas * price + value
what should be the issue?
Seeingthis when trying to create_collectible, no issues
executing deploy_advanced.
I modified the metadata a bit to be a collection of 6 tokens. Not sure if this is related to the bug below. I have link and eth in on rinkeby.
-> % brownie run scripts/advanced_collectible/create_collectible.py --network rinkeby
Brownie v1.16.2 - Python development framework for Ethereum
PoopContractProject is the active project.
Running 'scripts/advanced_collectible/create_collectible.py::main'...
args 0x4292d3dCD2568da968F2875F30e5dbe0E82C2C67 1000000000000000000 ['dev']
File "brownie/_cli/run.py", line 49, in main
return_value, frame = run(
File "brownie/project/scripts.py", line 103, in run
return_value = f_locals[method_name](*args, **kwargs)
File "./scripts/advanced_collectible/create_collectible.py", line 10, in main
fund_with_link(advanced_collectible.address)
File "./scripts/helpful_scripts.py", line 90, in fund_with_link
tx = interface.LinkTokenInterface(link_token).transfer(
File "brownie/network/contract.py", line 1692, in __call__
return self.transact(*args)
File "brownie/network/contract.py", line 1565, in transact
return tx["from"].transfer(
AttributeError: 'list' object has no attribute 'transfer'
brownie run scripts/advanced_collectible/fund_collectible.py --network rinkeby
Brownie v1.13.3 - Python development framework for Ethereum
NiftProject is the active project.
Running 'scripts/advanced_collectible/fund_collectible.py::main'...
File "brownie/_cli/run.py", line 49, in main
return_value, frame = run(
File "brownie/project/scripts.py", line 96, in run
return_value = f_locals[method_name](*args, **kwargs)
File "", line 4, in main
File "brownie/network/contract.py", line 158, in getitem
return self._contracts[i]
IndexError: list index out of range
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.