브라우니로 스마트 계약 개발 시간 절약
환경 설정
먼저 아래 링크를 사용하여 Windows 컴퓨터에서 Python을 다운로드합니다.
 https://www.python.org/
가장 중요한 것은 web3 라이브러리에 필요한 빌드 도구를 얻는 것입니다. 제 경우에는 V++ 2019 빌드 도구가 필요했습니다.
아래 링크를 사용하고 Tools for Visual Studio까지 아래로 스크롤하여 온라인 설치 관리자를 가져오고 필요한 버전을 설치합니다.
 https://visualstudio.microsoft.com/downloads/?q=build+tools
테스트용 메타마스크 지갑을 받고 계정을 만들고 등록합니다.
암호, 계정 주소, 개인 키
이 목적을 위해 rinkbey 테스트를 사용할 것이기 때문에 메타마스크 네트워크 섹션에서 테스트넷을 공개합니다.
여기에서 metamasc 지갑을 사용하여 테스트용 이더리움을 받으십시오.
 https://faucets.chain.link/
https://infura.io/에서 계정 만들기
프로젝트를 만들고 이름을 원하는 대로 지정하세요. 생성 과정이 끝난 후 rinkby 네트워크를 켜는 것을 잊지 마세요.
Project_id와 프로젝트 비밀 및 첫 번째 엔드포인트를 기록합니다.
Infura가 마음에 들지 않으면 다음을 사용할 수 있습니다. https://t.co/Ky3JWP8GPZ
아래 링크에서 Visualstudio 코드를 설치하십시오.
 https://code.visualstudio.com/
Solidity와 Python을 위한 몇 가지 유용한 확장 기능을 설치하십시오.
새 프로젝트를 열고 해당 파일 생성을 시작합니다.
관리자 규칙으로 pipx를 설치하기만 하면 가상 환경을 만들 필요가 없습니다.
python -m pip install --user pipx
powershell을 다시 열고 계속
python -m pipx ensurepath
powershell을 다시 열고 브라우니를 설치합니다.
pipx install eth-brownie
powershell을 다시 열고 브라우니에 필요한 파일을 초기화합니다.
brownie init
이제 새 폴더가 생겼습니다.
환경 변수
이름이 있는 필수 환경 변수를 추가합니다.
 
WEB3_INFURA_PROJECT_ID
most be equal to youre INFURA_ID in the project created
 SimpleStorage.sol
SimpleStorage.sol의 코드는 다음과 같습니다.
계약 폴더 아래에 파일 생성
 
 // SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.9.0;
contract SimpleStorage {
    uint256 favoriteNumber;
    // This is a comment!
    struct People {
        uint256 favoriteNumber;
        string name;
    }
    People[] public people;
    mapping(string => uint256) public nameToFavoriteNumber;
    function store(uint256 _favoriteNumber) public {
        favoriteNumber = _favoriteNumber;
    }
    function retrieve() public view returns (uint256){
        return favoriteNumber;
    }
    function addPerson(string memory _name, uint256 _favoriteNumber) public {
        people.push(People(_favoriteNumber, _name));
        nameToFavoriteNumber[_name] = _favoriteNumber;
    }
}
 
In the code above we just have a favoriteNumber variable that we can check with retrieve function and modify with the store functionand we can associate someone name with a favorite number with addPerson function
 Deploy.py
deploy.py의 코드는 다음과 같아야 합니다.
scripts 폴더 아래에 파일 생성
 #Security
from dotenv import load_dotenv
#Necessary
from brownie import accounts, config, SimpleStorage, network
def get_account():
    if network.show_active() == "development":
        return accounts.add(config["wallets"]["from_key"])
    else:
        return accounts.add(config["wallets"]["from_key_metama"])
def deploy_ss():
    print("ACCOUNT  =>",get_account())
    ss= SimpleStorage.deploy({"from": get_account()})
    trx = ss.store(7, {"from": get_account()})
    trx.wait(1)
    fav = ss.retrieve()
    print("FAV NOW   =>",fav)
def main():
    deploy_ss()
 
In the code above we are deploying the smart contract in the blockchain and interacting with it by storing the number 7 in favoriteNumber and the checking it
 .env/개인 키
이제 필요한 키를 채워야 합니다. 처음 두 변수는 Ganache와의 로컬 상호 작용에만 필요하므로 이스케이프할 수 있습니다.
.env 파일
 ACCOUNT="0xRandom3216547986549687"
PRIVAT_KEY="0xRandom3216547986549687"
INFURA_ID="654random65465"
INFURA_SEC="654random65465"
META_ADRESS="0x654random65465"
META_PRV="654random65465"
ENDPOINT_RINKBY="654random65465"
ENV_TYPE="INFURA"
 구성
brownie-config.yaml 파일에서 .env 파일은 개인 키의 변수 이름입니다.
 dotenv: "../.env"
wallets:
  from_key: ${PRIVAT_KEY}
  from_key_metama: ${META_PRV}
 배포/상호작용
마지막 단계만 실행하면 됩니다.
브라우니 실행 scripts/deploy.py --network rinkeby
나는 모든 것이 잘되기를 바랍니다
그렇다면 여기에서 계약을 확인하십시오.
 
https://rinkeby.etherscan.io/address/write_the_adress_of_the_contract
youre 브라우니 출력에서 제공하는 정보로 계약 주소를 얻을 수 있습니다.
 
SimpleStorage deployed at: 0xsdfsdfrandomsdfsdf
가난한 탐욕스러운 튜토리얼을 보려면 여기를 따르십시오.
                
                    
        
    
    
    
    
    
                
                
                
                
                    
                        
                            
                            
                            Reference
                            
                            이 문제에 관하여(브라우니로 스마트 계약 개발 시간 절약), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다
                                
                                https://dev.to/mrhili/save-time-developing-smart-contracts-with-brownie-4me9
                            
                            
                            
                                텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
                            
                            
                                
                                
                                 우수한 개발자 콘텐츠 발견에 전념
                                (Collection and Share based on the CC Protocol.)
                                
                                
                                우수한 개발자 콘텐츠 발견에 전념
                                (Collection and Share based on the CC Protocol.)
                            
                            
                        
                    
                
                
                
            
WEB3_INFURA_PROJECT_ID
most be equal to youre INFURA_ID in the project created
SimpleStorage.sol의 코드는 다음과 같습니다.
계약 폴더 아래에 파일 생성
 // SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.9.0;
contract SimpleStorage {
    uint256 favoriteNumber;
    // This is a comment!
    struct People {
        uint256 favoriteNumber;
        string name;
    }
    People[] public people;
    mapping(string => uint256) public nameToFavoriteNumber;
    function store(uint256 _favoriteNumber) public {
        favoriteNumber = _favoriteNumber;
    }
    function retrieve() public view returns (uint256){
        return favoriteNumber;
    }
    function addPerson(string memory _name, uint256 _favoriteNumber) public {
        people.push(People(_favoriteNumber, _name));
        nameToFavoriteNumber[_name] = _favoriteNumber;
    }
}
In the code above we just have a favoriteNumber variable that we can check with retrieve function and modify with the store functionand we can associate someone name with a favorite number with addPerson function
Deploy.py
deploy.py의 코드는 다음과 같아야 합니다.
scripts 폴더 아래에 파일 생성
 #Security
from dotenv import load_dotenv
#Necessary
from brownie import accounts, config, SimpleStorage, network
def get_account():
    if network.show_active() == "development":
        return accounts.add(config["wallets"]["from_key"])
    else:
        return accounts.add(config["wallets"]["from_key_metama"])
def deploy_ss():
    print("ACCOUNT  =>",get_account())
    ss= SimpleStorage.deploy({"from": get_account()})
    trx = ss.store(7, {"from": get_account()})
    trx.wait(1)
    fav = ss.retrieve()
    print("FAV NOW   =>",fav)
def main():
    deploy_ss()
 
In the code above we are deploying the smart contract in the blockchain and interacting with it by storing the number 7 in favoriteNumber and the checking it
 .env/개인 키
이제 필요한 키를 채워야 합니다. 처음 두 변수는 Ganache와의 로컬 상호 작용에만 필요하므로 이스케이프할 수 있습니다.
.env 파일
 ACCOUNT="0xRandom3216547986549687"
PRIVAT_KEY="0xRandom3216547986549687"
INFURA_ID="654random65465"
INFURA_SEC="654random65465"
META_ADRESS="0x654random65465"
META_PRV="654random65465"
ENDPOINT_RINKBY="654random65465"
ENV_TYPE="INFURA"
 구성
brownie-config.yaml 파일에서 .env 파일은 개인 키의 변수 이름입니다.
 dotenv: "../.env"
wallets:
  from_key: ${PRIVAT_KEY}
  from_key_metama: ${META_PRV}
 배포/상호작용
마지막 단계만 실행하면 됩니다.
브라우니 실행 scripts/deploy.py --network rinkeby
나는 모든 것이 잘되기를 바랍니다
그렇다면 여기에서 계약을 확인하십시오.
 
https://rinkeby.etherscan.io/address/write_the_adress_of_the_contract
youre 브라우니 출력에서 제공하는 정보로 계약 주소를 얻을 수 있습니다.
 
SimpleStorage deployed at: 0xsdfsdfrandomsdfsdf
가난한 탐욕스러운 튜토리얼을 보려면 여기를 따르십시오.
                
                    
        
    
    
    
    
    
                
                
                
                
                    
                        
                            
                            
                            Reference
                            
                            이 문제에 관하여(브라우니로 스마트 계약 개발 시간 절약), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다
                                
                                https://dev.to/mrhili/save-time-developing-smart-contracts-with-brownie-4me9
                            
                            
                            
                                텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
                            
                            
                                
                                
                                 우수한 개발자 콘텐츠 발견에 전념
                                (Collection and Share based on the CC Protocol.)
                                
                                
                                우수한 개발자 콘텐츠 발견에 전념
                                (Collection and Share based on the CC Protocol.)
                            
                            
                        
                    
                
                
                
            
#Security
from dotenv import load_dotenv
#Necessary
from brownie import accounts, config, SimpleStorage, network
def get_account():
    if network.show_active() == "development":
        return accounts.add(config["wallets"]["from_key"])
    else:
        return accounts.add(config["wallets"]["from_key_metama"])
def deploy_ss():
    print("ACCOUNT  =>",get_account())
    ss= SimpleStorage.deploy({"from": get_account()})
    trx = ss.store(7, {"from": get_account()})
    trx.wait(1)
    fav = ss.retrieve()
    print("FAV NOW   =>",fav)
def main():
    deploy_ss()
In the code above we are deploying the smart contract in the blockchain and interacting with it by storing the number 7 in favoriteNumber and the checking it
이제 필요한 키를 채워야 합니다. 처음 두 변수는 Ganache와의 로컬 상호 작용에만 필요하므로 이스케이프할 수 있습니다.
.env 파일
ACCOUNT="0xRandom3216547986549687"
PRIVAT_KEY="0xRandom3216547986549687"
INFURA_ID="654random65465"
INFURA_SEC="654random65465"
META_ADRESS="0x654random65465"
META_PRV="654random65465"
ENDPOINT_RINKBY="654random65465"
ENV_TYPE="INFURA"
구성
brownie-config.yaml 파일에서 .env 파일은 개인 키의 변수 이름입니다.
 dotenv: "../.env"
wallets:
  from_key: ${PRIVAT_KEY}
  from_key_metama: ${META_PRV}
 배포/상호작용
마지막 단계만 실행하면 됩니다.
브라우니 실행 scripts/deploy.py --network rinkeby
나는 모든 것이 잘되기를 바랍니다
그렇다면 여기에서 계약을 확인하십시오.
 
https://rinkeby.etherscan.io/address/write_the_adress_of_the_contract
youre 브라우니 출력에서 제공하는 정보로 계약 주소를 얻을 수 있습니다.
 
SimpleStorage deployed at: 0xsdfsdfrandomsdfsdf
가난한 탐욕스러운 튜토리얼을 보려면 여기를 따르십시오.
                
                    
        
    
    
    
    
    
                
                
                
                
                    
                        
                            
                            
                            Reference
                            
                            이 문제에 관하여(브라우니로 스마트 계약 개발 시간 절약), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다
                                
                                https://dev.to/mrhili/save-time-developing-smart-contracts-with-brownie-4me9
                            
                            
                            
                                텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
                            
                            
                                
                                
                                 우수한 개발자 콘텐츠 발견에 전념
                                (Collection and Share based on the CC Protocol.)
                                
                                
                                우수한 개발자 콘텐츠 발견에 전념
                                (Collection and Share based on the CC Protocol.)
                            
                            
                        
                    
                
                
                
            
dotenv: "../.env"
wallets:
  from_key: ${PRIVAT_KEY}
  from_key_metama: ${META_PRV}
마지막 단계만 실행하면 됩니다.
브라우니 실행 scripts/deploy.py --network rinkeby
나는 모든 것이 잘되기를 바랍니다
그렇다면 여기에서 계약을 확인하십시오.
https://rinkeby.etherscan.io/address/write_the_adress_of_the_contract
youre 브라우니 출력에서 제공하는 정보로 계약 주소를 얻을 수 있습니다.
SimpleStorage deployed at: 0xsdfsdfrandomsdfsdf
가난한 탐욕스러운 튜토리얼을 보려면 여기를 따르십시오.
Reference
이 문제에 관하여(브라우니로 스마트 계약 개발 시간 절약), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://dev.to/mrhili/save-time-developing-smart-contracts-with-brownie-4me9텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
                                
                                
                                
                                
                                
                                우수한 개발자 콘텐츠 발견에 전념
                                (Collection and Share based on the CC Protocol.)