Mode:
Duration:
1
Coding works best on desktop or with an external keyboard.
Coding works best on desktop or with an external keyboard.
Deploy and interact with an ERC721 NFT smart contract using Brownie.
# contracts/MyNFT.sol
pragma solidity ^0.8.0;
import '@openzeppelin/contracts/token/ERC721/ERC721.sol';
contract MyNFT is ERC721 {
constructor() ERC721('MyNFT','MNFT') {}
function mint(address to, uint256 tokenId) public { _mint(to, tokenId); }
}
# deploy.py
from brownie import MyNFT, accounts
def main():
acct = accounts[0]
nft = MyNFT.deploy({'from': acct})
nft.mint(acct, 1, {'from': acct})
print('Minted NFT ID 1 to account:', acct)Brownie is an open-source Python-based framework for Ethereum smart contract development, testing, and deployment. It integrates with Ethereum networks and provides a full-featured environment for building decentralized applications (dApps).
Origin & Creator
Brownie was created by Matt Lockyer in 2018 to simplify Ethereum smart contract development using Python, providing a familiar developer workflow for testing, deployment, and interaction.
Industrial Note
Brownie is widely used in DeFi, NFT, and other blockchain applications for rapid smart contract development and testing, particularly when Python-based workflows are preferred.