Ver3.5 Python 블록체인과 Web3.py를 활용한DApp 개발 완전 정복 🚀

Python 블록체인과 Web3.py를 활용한
DApp 개발 완전 정복 🚀
야, 솔직히 말하자. 블록체인이라는 단어 들으면 아직도 "비트코인? 이더리움? 그거 투자하는 거 아니야?" 하는 생각 먼저 드는 사람 많지? 😄
근데 오늘은 그 블록체인 위에서 실제로 돌아가는 앱(DApp)을 Python으로 만드는 방법을 아주 친절하게, 재미있게 풀어볼 거야.
코드도 있고, 개념도 있고, 실전 팁도 있어. 커피 한 잔 들고 편하게 앉아봐 ☕
DApp은 Decentralized Application의 줄임말이야. 한국어로 하면 탈중앙화 애플리케이션.
일반 앱이랑 뭐가 다르냐고? 핵심 차이를 딱 정리해줄게.
| 구분 | 일반 앱 (중앙화) | DApp (탈중앙화) |
|---|---|---|
| 데이터 저장 | 회사 서버 (AWS, GCP 등) | 블록체인 네트워크 |
| 운영 주체 | 특정 기업/개인 | 스마트 컨트랙트 코드 |
| 검열 가능성 | 가능 (서버 차단 등) | 불가 (코드가 곧 법) |
| 투명성 | 내부 로직 불투명 | 코드 공개, 누구나 검증 |
| 장애 내성 | 서버 다운 = 서비스 중단 | 네트워크 전체가 다운되지 않는 한 동작 |
쉽게 말하면, 일반 앱은 카카오 서버가 터지면 카카오톡 못 쓰는 거고,
DApp은 이더리움 네트워크 전체가 죽지 않는 한 계속 돌아가는 거야. 🔥
물론 단점도 있어. 속도가 느리고, 가스비(수수료)가 들고, 한번 배포하면 수정이 어렵다는 점.
하지만 그 특성 때문에 금융, 투표, NFT, DAO 같은 분야에서 엄청난 가능성을 보여주고 있지.
자, 이제 진짜 시작이야. 먼저 개발 환경을 세팅해야 해.
Python 기반이니까 Python은 이미 설치되어 있다고 가정할게 (Python 3.8 이상 권장).
pip install web3
pip install eth-account
pip install python-dotenv
pip install solcx # Solidity 컴파일러 (선택사항)
python -m venv dapp-env 로 가상환경 만들고,source dapp-env/bin/activate (Mac/Linux) 또는 dapp-env\Scripts\activate (Windows) 로 활성화해줘.패키지 충돌 방지에 진짜 도움 돼.
블록체인과 통신하려면 이더리움 노드가 필요해. 크게 3가지 방법이 있어.
이 글에서는 Infura + Sepolia 테스트넷 조합을 주로 쓸 거야.
테스트넷은 실제 이더 없이 테스트 이더(faucet에서 무료로 받을 수 있음)로 실험할 수 있어서 개발할 때 딱이거든.
Web3.py는 이더리움 블록체인과 Python이 대화할 수 있게 해주는 라이브러리야.
JavaScript 세계의 ethers.js나 web3.js와 같은 역할을 Python에서 해주는 거지.
from web3 import Web3
import os
from dotenv import load_dotenv
load_dotenv() # .env 파일에서 환경변수 로드
# Infura를 통한 Sepolia 테스트넷 연결
INFURA_URL = f"https://sepolia.infura.io/v3/{os.getenv('INFURA_API_KEY')}"
w3 = Web3(Web3.HTTPProvider(INFURA_URL))
# 연결 확인
if w3.is_connected():
print("✅ 이더리움 네트워크 연결 성공!")
print(f"현재 블록 번호: {w3.eth.block_number}")
else:
print("❌ 연결 실패. API 키를 확인해줘!")
INFURA_API_KEY=여기에_인퓨라_API_키_입력
PRIVATE_KEY=여기에_지갑_개인키_입력
MY_ADDRESS=여기에_지갑_주소_입력
from web3 import Web3
import os
from dotenv import load_dotenv
load_dotenv()
w3 = Web3(Web3.HTTPProvider(f"https://sepolia.infura.io/v3/{os.getenv('INFURA_API_KEY')}"))
# 주소 잔액 조회
address = os.getenv('MY_ADDRESS')
balance_wei = w3.eth.get_balance(address)
# Wei를 Ether로 변환 (1 Ether = 10^18 Wei)
balance_eth = w3.from_wei(balance_wei, 'ether')
print(f"주소: {address}")
print(f"잔액: {balance_eth} ETH")
print(f"잔액 (Wei): {balance_wei}")
1 Ether = 1,000,000,000 Gwei = 1,000,000,000,000,000,000 Wei (10^18)
가스비 계산할 때 Gwei 단위를 많이 쓰고, 일반 거래는 Ether 단위를 써.
from web3 import Web3
import os
from dotenv import load_dotenv
load_dotenv()
w3 = Web3(Web3.HTTPProvider(f"https://sepolia.infura.io/v3/{os.getenv('INFURA_API_KEY')}"))
# 최신 블록 정보 가져오기
latest_block = w3.eth.get_block('latest')
print(f"블록 번호: {latest_block['number']}")
print(f"블록 해시: {latest_block['hash'].hex()}")
print(f"타임스탬프: {latest_block['timestamp']}")
print(f"트랜잭션 수: {len(latest_block['transactions'])}")
print(f"가스 사용량: {latest_block['gasUsed']}")
print(f"가스 한도: {latest_block['gasLimit']}")
# 특정 블록 번호로 조회
block_5000000 = w3.eth.get_block(5000000)
print(f"\n블록 5000000 해시: {block_5000000['hash'].hex()}")
이제 진짜 재미있는 부분이야. 실제로 이더를 전송하는 코드를 작성해보자.
물론 테스트넷에서 테스트 이더로 해야 해! 실제 돈 날리면 안 되니까 😅
from web3 import Web3
import os
from dotenv import load_dotenv
load_dotenv()
w3 = Web3(Web3.HTTPProvider(f"https://sepolia.infura.io/v3/{os.getenv('INFURA_API_KEY')}"))
# 지갑 정보
sender_address = os.getenv('MY_ADDRESS')
private_key = os.getenv('PRIVATE_KEY')
recipient_address = "0x수신자_주소_여기에"
# 현재 가스 가격 조회
gas_price = w3.eth.gas_price
print(f"현재 가스 가격: {w3.from_wei(gas_price, 'gwei')} Gwei")
# 트랜잭션 구성
transaction = {
'nonce': w3.eth.get_transaction_count(sender_address), # 논스 (트랜잭션 순서)
'to': recipient_address,
'value': w3.to_wei(0.001, 'ether'), # 0.001 ETH 전송
'gas': 21000, # 기본 ETH 전송 가스
'gasPrice': gas_price,
'chainId': 11155111 # Sepolia 테스트넷 체인 ID
}
# 트랜잭션 서명
signed_txn = w3.eth.account.sign_transaction(transaction, private_key)
# 트랜잭션 전송
tx_hash = w3.eth.send_raw_transaction(signed_txn.raw_transaction)
print(f"트랜잭션 해시: {tx_hash.hex()}")
# 컨펌 대기 (블록에 포함될 때까지)
print("컨펌 대기 중...")
receipt = w3.eth.wait_for_transaction_receipt(tx_hash)
print(f"✅ 트랜잭션 완료!")
print(f"블록 번호: {receipt['blockNumber']}")
print(f"가스 사용량: {receipt['gasUsed']}")
print(f"상태: {'성공' if receipt['status'] == 1 else '실패'}")
0부터 시작해서 트랜잭션을 보낼 때마다 1씩 증가해.
이게 있어야 같은 트랜잭션이 두 번 실행되는 걸 막을 수 있어 (리플레이 어택 방지).
w3.eth.get_transaction_count(address)로 현재 논스를 가져올 수 있어.
DApp의 핵심은 스마트 컨트랙트야. 스마트 컨트랙트는 블록체인 위에서 실행되는 코드인데,
한번 배포하면 누구도 수정할 수 없고, 조건이 맞으면 자동으로 실행돼.
주로 Solidity라는 언어로 작성하고, 이더리움 가상 머신(EVM) 위에서 돌아가.
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
contract SimpleStorage {
// 상태 변수 (블록체인에 영구 저장됨)
uint256 private storedValue;
address public owner;
// 이벤트 (로그 기록용)
event ValueChanged(uint256 oldValue, uint256 newValue, address changedBy);
// 생성자 (배포 시 한 번만 실행)
constructor() {
owner = msg.sender;
storedValue = 0;
}
// 값 저장 함수 (상태 변경 = 가스 소모)
function setValue(uint256 _value) public {
uint256 oldValue = storedValue;
storedValue = _value;
emit ValueChanged(oldValue, _value, msg.sender);
}
// 값 조회 함수 (읽기 전용 = 가스 무료)
function getValue() public view returns (uint256) {
return storedValue;
}
// 소유자만 실행 가능한 함수
function resetValue() public {
require(msg.sender == owner, "Only owner can reset!");
storedValue = 0;
}
}
pure: 상태도 안 읽고 안 씀. 순수 계산만. 가스비 없음.
일반 함수: 상태를 변경함. 트랜잭션 필요. 가스비 발생.
Solidity 코드를 블록체인에 배포하려면 먼저 컴파일해서 ABI와 바이트코드를 얻어야 해.
from solcx import compile_standard, install_solc
import json
# Solidity 컴파일러 설치
install_solc('0.8.0')
# Solidity 소스 코드 읽기
with open('SimpleStorage.sol', 'r') as f:
source_code = f.read()
# 컴파일
compiled_sol = compile_standard({
"language": "Solidity",
"sources": {
"SimpleStorage.sol": {
"content": source_code
}
},
"settings": {
"outputSelection": {
"*": {
"*": ["abi", "metadata", "evm.bytecode", "evm.sourceMap"]
}
}
}
}, solc_version='0.8.0')
# 컴파일 결과 저장
with open('compiled_code.json', 'w') as f:
json.dump(compiled_sol, f)
# ABI와 바이트코드 추출
abi = compiled_sol['contracts']['SimpleStorage.sol']['SimpleStorage']['abi']
bytecode = compiled_sol['contracts']['SimpleStorage.sol']['SimpleStorage']['evm']['bytecode']['object']
print("✅ 컴파일 완료!")
print(f"ABI 함수 수: {len(abi)}")
print(f"바이트코드 길이: {len(bytecode)} 문자")
# 나중에 사용하기 위해 저장
with open('abi.json', 'w') as f:
json.dump(abi, f, indent=2)
with open('bytecode.txt', 'w') as f:
f.write(bytecode)
어떤 함수가 있고, 어떤 파라미터를 받고, 어떤 값을 반환하는지 정의해.
Web3.py가 이 ABI를 보고 컨트랙트와 어떻게 대화할지 알게 되는 거야.
ABI 없이는 컨트랙트 함수를 호출할 수 없어!
컴파일까지 했으면 이제 블록체인에 배포할 차례야!
배포는 특별한 트랜잭션을 보내는 거야. 수신자 주소가 없고, 바이트코드를 데이터로 담아서 보내.
from web3 import Web3
import json
import os
from dotenv import load_dotenv
load_dotenv()
w3 = Web3(Web3.HTTPProvider(f"https://sepolia.infura.io/v3/{os.getenv('INFURA_API_KEY')}"))
# ABI와 바이트코드 로드
with open('abi.json', 'r') as f:
abi = json.load(f)
with open('bytecode.txt', 'r') as f:
bytecode = f.read()
# 계정 설정
account = w3.eth.account.from_key(os.getenv('PRIVATE_KEY'))
print(f"배포 계정: {account.address}")
# 컨트랙트 객체 생성
SimpleStorage = w3.eth.contract(abi=abi, bytecode=bytecode)
# 배포 트랜잭션 구성
deploy_txn = SimpleStorage.constructor().build_transaction({
'from': account.address,
'nonce': w3.eth.get_transaction_count(account.address),
'gas': 500000, # 배포는 가스가 더 많이 필요해
'gasPrice': w3.eth.gas_price,
'chainId': 11155111 # Sepolia
})
# 서명 및 전송
signed_txn = w3.eth.account.sign_transaction(deploy_txn, os.getenv('PRIVATE_KEY'))
tx_hash = w3.eth.send_raw_transaction(signed_txn.raw_transaction)
print(f"배포 트랜잭션 해시: {tx_hash.hex()}")
print("배포 완료 대기 중...")
# 영수증 대기
receipt = w3.eth.wait_for_transaction_receipt(tx_hash)
contract_address = receipt['contractAddress']
print(f"✅ 컨트랙트 배포 완료!")
print(f"컨트랙트 주소: {contract_address}")
print(f"가스 사용량: {receipt['gasUsed']}")
# 주소 저장 (나중에 사용)
with open('contract_address.txt', 'w') as f:
f.write(contract_address)
배포까지 완료했어! 이제 진짜 재미있는 부분이야.
배포된 컨트랙트의 함수를 Python으로 호출해보자.
from web3 import Web3
import json
import os
from dotenv import load_dotenv
load_dotenv()
w3 = Web3(Web3.HTTPProvider(f"https://sepolia.infura.io/v3/{os.getenv('INFURA_API_KEY')}"))
# ABI와 컨트랙트 주소 로드
with open('abi.json', 'r') as f:
abi = json.load(f)
with open('contract_address.txt', 'r') as f:
contract_address = f.read().strip()
# 컨트랙트 인스턴스 생성
contract = w3.eth.contract(address=contract_address, abi=abi)
account = w3.eth.account.from_key(os.getenv('PRIVATE_KEY'))
# ===== 읽기 함수 호출 (가스비 없음) =====
current_value = contract.functions.getValue().call()
print(f"현재 저장된 값: {current_value}")
owner = contract.functions.owner().call()
print(f"컨트랙트 소유자: {owner}")
# ===== 쓰기 함수 호출 (가스비 발생) =====
print("\n값을 42로 변경 중...")
# 트랜잭션 빌드
set_value_txn = contract.functions.setValue(42).build_transaction({
'from': account.address,
'nonce': w3.eth.get_transaction_count(account.address),
'gas': 100000,
'gasPrice': w3.eth.gas_price,
'chainId': 11155111
})
# 서명 및 전송
signed_txn = w3.eth.account.sign_transaction(set_value_txn, os.getenv('PRIVATE_KEY'))
tx_hash = w3.eth.send_raw_transaction(signed_txn.raw_transaction)
print(f"트랜잭션 해시: {tx_hash.hex()}")
receipt = w3.eth.wait_for_transaction_receipt(tx_hash)
print(f"✅ 트랜잭션 완료! 상태: {'성공' if receipt['status'] == 1 else '실패'}")
# 변경 후 값 확인
new_value = contract.functions.getValue().call()
print(f"변경된 값: {new_value}")
스마트 컨트랙트에서 발생하는 이벤트를 Python으로 감지할 수 있어.
이건 DApp에서 실시간 업데이트를 구현할 때 엄청 유용해!
from web3 import Web3
import json
import os
from dotenv import load_dotenv
load_dotenv()
w3 = Web3(Web3.HTTPProvider(f"https://sepolia.infura.io/v3/{os.getenv('INFURA_API_KEY')}"))
with open('abi.json', 'r') as f:
abi = json.load(f)
with open('contract_address.txt', 'r') as f:
contract_address = f.read().strip()
contract = w3.eth.contract(address=contract_address, abi=abi)
# 과거 이벤트 조회
print("=== 과거 ValueChanged 이벤트 조회 ===")
events = contract.events.ValueChanged.get_logs(from_block=0)
for event in events:
print(f"블록: {event['blockNumber']}")
print(f"이전 값: {event['args']['oldValue']}")
print(f"새 값: {event['args']['newValue']}")
print(f"변경자: {event['args']['changedBy']}")
print("---")
# 실시간 이벤트 감지 (WebSocket 필요)
# WebSocket 연결 (Infura WebSocket 엔드포인트 사용)
WS_URL = f"wss://sepolia.infura.io/ws/v3/{os.getenv('INFURA_API_KEY')}"
w3_ws = Web3(Web3.WebsocketProvider(WS_URL))
contract_ws = w3_ws.eth.contract(address=contract_address, abi=abi)
# 이벤트 필터 생성
event_filter = contract_ws.events.ValueChanged.create_filter(from_block='latest')
print("\n=== 실시간 이벤트 감지 시작 (Ctrl+C로 종료) ===")
import time
try:
while True:
for event in event_filter.get_new_entries():
print(f"🔔 새 이벤트 감지!")
print(f" 이전 값: {event['args']['oldValue']}")
print(f" 새 값: {event['args']['newValue']}")
time.sleep(2)
except KeyboardInterrupt:
print("이벤트 감지 종료")
ERC-20은 이더리움에서 가장 많이 쓰이는 토큰 표준이야.
USDT, LINK, UNI 같은 토큰들이 다 이 표준을 따르고 있어.
Web3.py로 ERC-20 토큰을 다루는 방법을 알아보자.
from web3 import Web3
import json
import os
from dotenv import load_dotenv
load_dotenv()
w3 = Web3(Web3.HTTPProvider(f"https://mainnet.infura.io/v3/{os.getenv('INFURA_API_KEY')}"))
# ERC-20 표준 ABI (최소한의 함수만 포함)
ERC20_ABI = json.loads('''[
{"constant": true, "inputs": [], "name": "name",
"outputs": [{"name": "", "type": "string"}], "type": "function"},
{"constant": true, "inputs": [], "name": "symbol",
"outputs": [{"name": "", "type": "string"}], "type": "function"},
{"constant": true, "inputs": [], "name": "decimals",
"outputs": [{"name": "", "type": "uint8"}], "type": "function"},
{"constant": true, "inputs": [], "name": "totalSupply",
"outputs": [{"name": "", "type": "uint256"}], "type": "function"},
{"constant": true, "inputs": [{"name": "_owner", "type": "address"}],
"name": "balanceOf",
"outputs": [{"name": "balance", "type": "uint256"}], "type": "function"},
{"constant": false, "inputs": [
{"name": "_to", "type": "address"},
{"name": "_value", "type": "uint256"}
], "name": "transfer",
"outputs": [{"name": "", "type": "bool"}], "type": "function"}
]''')
# USDC 토큰 주소 (이더리움 메인넷)
USDC_ADDRESS = "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"
# 컨트랙트 인스턴스
usdc = w3.eth.contract(address=USDC_ADDRESS, abi=ERC20_ABI)
# 토큰 정보 조회
name = usdc.functions.name().call()
symbol = usdc.functions.symbol().call()
decimals = usdc.functions.decimals().call()
total_supply = usdc.functions.totalSupply().call()
print(f"토큰 이름: {name}")
print(f"심볼: {symbol}")
print(f"소수점 자리수: {decimals}")
print(f"총 발행량: {total_supply / (10 ** decimals):,.2f} {symbol}")
# 특정 주소의 잔액 조회
# Binance 핫월렛 주소 (예시)
binance_address = "0x28C6c06298d514Db089934071355E5743bf21d60"
balance = usdc.functions.balanceOf(binance_address).call()
print(f"\nBinance 지갑 USDC 잔액: {balance / (10 ** decimals):,.2f} USDC")
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
// OpenZeppelin ERC-20 임포트 (실제 프로젝트에서는 이걸 써!)
// import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
contract MyToken {
string public name = "재능 토큰";
string public symbol = "JNT"; // JaeNung Token
uint8 public decimals = 18;
uint256 public totalSupply;
mapping(address => uint256) public balanceOf;
mapping(address => mapping(address => uint256)) public allowance;
address public owner;
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
constructor(uint256 _initialSupply) {
owner = msg.sender;
totalSupply = _initialSupply * 10 ** uint256(decimals);
balanceOf[msg.sender] = totalSupply;
emit Transfer(address(0), msg.sender, totalSupply);
}
function transfer(address _to, uint256 _value) public returns (bool) {
require(balanceOf[msg.sender] >= _value, "잔액 부족!");
require(_to != address(0), "잘못된 주소!");
balanceOf[msg.sender] -= _value;
balanceOf[_to] += _value;
emit Transfer(msg.sender, _to, _value);
return true;
}
function approve(address _spender, uint256 _value) public returns (bool) {
allowance[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
function transferFrom(address _from, address _to, uint256 _value)
public returns (bool) {
require(balanceOf[_from] >= _value, "잔액 부족!");
require(allowance[_from][msg.sender] >= _value, "승인 한도 초과!");
balanceOf[_from] -= _value;
balanceOf[_to] += _value;
allowance[_from][msg.sender] -= _value;
emit Transfer(_from, _to, _value);
return true;
}
// 추가 토큰 발행 (소유자만)
function mint(address _to, uint256 _amount) public {
require(msg.sender == owner, "소유자만 가능!");
uint256 amount = _amount * 10 ** uint256(decimals);
totalSupply += amount;
balanceOf[_to] += amount;
emit Transfer(address(0), _to, amount);
}
}
이제 진짜 실전이야! 블록체인 기반 투표 시스템을 만들어볼 거야.
투표는 DApp의 대표적인 사용 사례야. 투명하고, 조작 불가능하고, 누구나 결과를 검증할 수 있거든.
재능넷 같은 플랫폼에서도 이런 투명한 투표 시스템을 활용하면 신뢰도를 높일 수 있겠지? 😊
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
contract Voting {
struct Candidate {
string name;
uint256 voteCount;
}
address public chairperson;
mapping(address => bool) public hasVoted;
Candidate[] public candidates;
bool public votingOpen;
uint256 public votingEndTime;
event Voted(address indexed voter, uint256 candidateIndex);
event VotingStarted(uint256 endTime);
event VotingEnded(uint256 winnerIndex, string winnerName);
constructor(string[] memory _candidateNames, uint256 _durationMinutes) {
chairperson = msg.sender;
votingOpen = false;
for (uint i = 0; i < _candidateNames.length; i++) {
candidates.push(Candidate({
name: _candidateNames[i],
voteCount: 0
}));
}
// 투표 즉시 시작
votingOpen = true;
votingEndTime = block.timestamp + (_durationMinutes * 60);
emit VotingStarted(votingEndTime);
}
function vote(uint256 _candidateIndex) public {
require(votingOpen, "투표가 열려있지 않습니다!");
require(block.timestamp < votingEndTime, "투표 시간이 종료되었습니다!");
require(!hasVoted[msg.sender], "이미 투표하셨습니다!");
require(_candidateIndex < candidates.length, "잘못된 후보 번호!");
hasVoted[msg.sender] = true;
candidates[_candidateIndex].voteCount++;
emit Voted(msg.sender, _candidateIndex);
}
function getWinner() public view returns (uint256 winnerIndex, string memory winnerName, uint256 winnerVotes) {
require(block.timestamp >= votingEndTime || !votingOpen, "투표가 아직 진행 중입니다!");
uint256 maxVotes = 0;
for (uint i = 0; i < candidates.length; i++) {
if (candidates[i].voteCount > maxVotes) {
maxVotes = candidates[i].voteCount;
winnerIndex = i;
}
}
winnerName = candidates[winnerIndex].name;
winnerVotes = candidates[winnerIndex].voteCount;
}
function getCandidateCount() public view returns (uint256) {
return candidates.length;
}
function getRemainingTime() public view returns (uint256) {
if (block.timestamp >= votingEndTime) return 0;
return votingEndTime - block.timestamp;
}
}
from web3 import Web3
import json
import os
import time
from dotenv import load_dotenv
load_dotenv()
w3 = Web3(Web3.HTTPProvider(f"https://sepolia.infura.io/v3/{os.getenv('INFURA_API_KEY')}"))
# ABI 로드 (Voting 컨트랙트 ABI)
with open('voting_abi.json', 'r') as f:
abi = json.load(f)
with open('voting_address.txt', 'r') as f:
contract_address = f.read().strip()
voting = w3.eth.contract(address=contract_address, abi=abi)
account = w3.eth.account.from_key(os.getenv('PRIVATE_KEY'))
def display_candidates():
"""후보자 목록과 득표수 출력"""
count = voting.functions.getCandidateCount().call()
print("\n=== 현재 투표 현황 ===")
for i in range(count):
candidate = voting.functions.candidates(i).call()
print(f" [{i}] {candidate[0]}: {candidate[1]}표")
remaining = voting.functions.getRemainingTime().call()
if remaining > 0:
minutes = remaining // 60
seconds = remaining % 60
print(f"\n⏰ 남은 시간: {minutes}분 {seconds}초")
else:
print("\n⏰ 투표 종료!")
def cast_vote(candidate_index):
"""투표 실행"""
# 이미 투표했는지 확인
has_voted = voting.functions.hasVoted(account.address).call()
if has_voted:
print("❌ 이미 투표하셨습니다!")
return
print(f"후보 {candidate_index}번에 투표 중...")
txn = voting.functions.vote(candidate_index).build_transaction({
'from': account.address,
'nonce': w3.eth.get_transaction_count(account.address),
'gas': 100000,
'gasPrice': w3.eth.gas_price,
'chainId': 11155111
})
signed_txn = w3.eth.account.sign_transaction(txn, os.getenv('PRIVATE_KEY'))
tx_hash = w3.eth.send_raw_transaction(signed_txn.raw_transaction)
print(f"트랜잭션 해시: {tx_hash.hex()}")
receipt = w3.eth.wait_for_transaction_receipt(tx_hash)
if receipt['status'] == 1:
print("✅ 투표 완료!")
else:
print("❌ 투표 실패!")
def get_winner():
"""승자 조회"""
try:
result = voting.functions.getWinner().call()
print(f"\n🏆 승자: {result[1]}")
print(f"득표수: {result[2]}표")
except Exception as e:
print(f"투표가 아직 진행 중이거나 오류 발생: {e}")
# 메인 실행
print("🗳️ 블록체인 투표 시스템")
display_candidates()
# 투표 실행 (0번 후보에 투표)
cast_vote(0)
# 결과 확인
display_candidates()
DApp 개발에서 계정 관리는 정말 중요한 부분이야.
Web3.py의 eth.account 모듈로 다양한 지갑 기능을 구현할 수 있어.
from web3 import Web3
from eth_account import Account
import secrets
import json
w3 = Web3()
# ===== 새 지갑 생성 =====
print("=== 새 지갑 생성 ===")
# 방법 1: 랜덤 개인키로 생성
private_key = "0x" + secrets.token_hex(32)
account = Account.from_key(private_key)
print(f"개인키: {private_key}")
print(f"주소: {account.address}")
# 방법 2: 니모닉(시드 문구)으로 생성
Account.enable_unaudited_hdwallet_features()
mnemonic = Account.create_with_mnemonic()
print(f"\n니모닉: {mnemonic[1]}")
print(f"주소: {mnemonic[0].address}")
# ===== 메시지 서명 =====
print("\n=== 메시지 서명 ===")
message = "안녕하세요, 저는 이 지갑의 소유자입니다!"
signed_message = w3.eth.account.sign_message(
w3.eth.account.encode_defunct(text=message),
private_key=private_key
)
print(f"서명: {signed_message.signature.hex()}")
# ===== 서명 검증 =====
recovered_address = w3.eth.account.recover_message(
w3.eth.account.encode_defunct(text=message),
signature=signed_message.signature
)
print(f"복구된 주소: {recovered_address}")
print(f"서명 검증: {'✅ 일치' if recovered_address == account.address else '❌ 불일치'}")
# ===== 키스토어 파일 생성 (암호화된 지갑 저장) =====
print("\n=== 키스토어 파일 생성 ===")
password = "my_secure_password_123"
keystore = Account.encrypt(private_key, password)
with open('keystore.json', 'w') as f:
json.dump(keystore, f, indent=2)
print("키스토어 파일 저장 완료: keystore.json")
# ===== 키스토어 파일로 복구 =====
with open('keystore.json', 'r') as f:
keystore_data = json.load(f)
recovered_key = Account.decrypt(keystore_data, password)
recovered_account = Account.from_key(recovered_key)
print(f"복구된 주소: {recovered_account.address}")
서버에서 랜덤 메시지를 주면, 사용자가 자신의 개인키로 서명하고,
서버는 서명을 검증해서 해당 주소의 소유자임을 확인하는 방식이야.
비밀번호 없이 지갑으로 로그인하는 Web3 인증의 핵심 원리야!
블록체인 개발에서 가스 최적화는 진짜 중요해.
가스비가 비쌀 때는 간단한 트랜잭션 하나에 수만 원이 들기도 하거든.
Python으로 가스를 효율적으로 관리하는 방법을 알아보자.
from web3 import Web3
import os
from dotenv import load_dotenv
load_dotenv()
w3 = Web3(Web3.HTTPProvider(f"https://sepolia.infura.io/v3/{os.getenv('INFURA_API_KEY')}"))
# ===== 현재 가스 가격 분석 =====
print("=== 가스 가격 분석 ===")
# 현재 가스 가격
current_gas_price = w3.eth.gas_price
print(f"현재 가스 가격: {w3.from_wei(current_gas_price, 'gwei'):.2f} Gwei")
# EIP-1559 기반 가스 가격 (더 효율적)
latest_block = w3.eth.get_block('latest')
base_fee = latest_block.get('baseFeePerGas', 0)
print(f"현재 기본 수수료(Base Fee): {w3.from_wei(base_fee, 'gwei'):.2f} Gwei")
# 권장 우선순위 수수료
priority_fee = w3.eth.max_priority_fee
print(f"권장 우선순위 수수료: {w3.from_wei(priority_fee, 'gwei'):.2f} Gwei")
# ===== 가스 추정 =====
print("\n=== 가스 추정 ===")
# 단순 ETH 전송 가스 추정
estimated_gas = w3.eth.estimate_gas({
'from': os.getenv('MY_ADDRESS'),
'to': '0x742d35Cc6634C0532925a3b8D4C9C5e5e5e5e5e5',
'value': w3.to_wei(0.001, 'ether')
})
print(f"ETH 전송 예상 가스: {estimated_gas}")
print(f"예상 비용: {w3.from_wei(estimated_gas * current_gas_price, 'ether'):.8f} ETH")
# ===== EIP-1559 트랜잭션 (더 효율적) =====
print("\n=== EIP-1559 트랜잭션 구성 ===")
max_fee_per_gas = base_fee * 2 + priority_fee # 기본 수수료의 2배 + 우선순위 수수료
print(f"최대 가스 가격 설정: {w3.from_wei(max_fee_per_gas, 'gwei'):.2f} Gwei")
eip1559_txn = {
'from': os.getenv('MY_ADDRESS'),
'to': '0x742d35Cc6634C0532925a3b8D4C9C5e5e5e5e5e5',
'value': w3.to_wei(0.001, 'ether'),
'gas': 21000,
'maxFeePerGas': max_fee_per_gas,
'maxPriorityFeePerGas': priority_fee,
'nonce': w3.eth.get_transaction_count(os.getenv('MY_ADDRESS')),
'chainId': 11155111,
'type': 2 # EIP-1559 트랜잭션 타입
}
print("EIP-1559 트랜잭션 구성 완료!")
print(f" 최대 수수료: {w3.from_wei(max_fee_per_gas, 'gwei'):.2f} Gwei")
print(f" 우선순위 수수료: {w3.from_wei(priority_fee, 'gwei'):.2f} Gwei")
EIP-1559 방식: baseFee(자동 조정) + priorityFee(팁) 구조. 더 예측 가능하고 효율적.
이더리움 런던 하드포크(2021년 8월) 이후 EIP-1559가 표준이 됐어.
새 프로젝트라면 EIP-1559 방식을 쓰는 게 좋아!
이제 Python Flask와 Web3.py를 결합해서 실제 DApp 백엔드를 만들어보자.
프론트엔드(React, Vue 등)와 통신할 수 있는 REST API를 구축하는 거야.
from flask import Flask, jsonify, request
from web3 import Web3
import json
import os
from dotenv import load_dotenv
from functools import wraps
load_dotenv()
app = Flask(__name__)
# Web3 설정
w3 = Web3(Web3.HTTPProvider(f"https://sepolia.infura.io/v3/{os.getenv('INFURA_API_KEY')}"))
# 컨트랙트 로드
with open('voting_abi.json', 'r') as f:
abi = json.load(f)
with open('voting_address.txt', 'r') as f:
contract_address = f.read().strip()
voting_contract = w3.eth.contract(address=contract_address, abi=abi)
# ===== 유틸리티 함수 =====
def verify_signature(message, signature, expected_address):
"""서명 검증으로 사용자 인증"""
try:
recovered = w3.eth.account.recover_message(
w3.eth.account.encode_defunct(text=message),
signature=signature
)
return recovered.lower() == expected_address.lower()
except:
return False
# ===== API 엔드포인트 =====
@app.route('/api/status', methods=['GET'])
def get_status():
"""블록체인 연결 상태 확인"""
return jsonify({
'connected': w3.is_connected(),
'block_number': w3.eth.block_number,
'network': 'Sepolia Testnet'
})
@app.route('/api/candidates', methods=['GET'])
def get_candidates():
"""후보자 목록 조회"""
count = voting_contract.functions.getCandidateCount().call()
candidates = []
for i in range(count):
candidate = voting_contract.functions.candidates(i).call()
candidates.append({
'index': i,
'name': candidate[0],
'voteCount': candidate[1]
})
remaining_time = voting_contract.functions.getRemainingTime().call()
return jsonify({
'candidates': candidates,
'remainingTime': remaining_time,
'votingOpen': remaining_time > 0
})
@app.route('/api/vote', methods=['POST'])
def cast_vote():
"""투표 처리"""
data = request.json
# 필수 파라미터 확인
required = ['address', 'candidateIndex', 'signature']
for field in required:
if field not in data:
return jsonify({'error': f'{field} 필드가 필요합니다'}), 400
address = data['address']
candidate_index = data['candidateIndex']
signature = data['signature']
# 서명 검증 (사용자 인증)
message = f"투표: 후보 {candidate_index}번에 투표합니다"
if not verify_signature(message, signature, address):
return jsonify({'error': '서명 검증 실패'}), 401
# 이미 투표했는지 확인
has_voted = voting_contract.functions.hasVoted(address).call()
if has_voted:
return jsonify({'error': '이미 투표하셨습니다'}), 400
# 서버 계정으로 트랜잭션 전송 (가스비 대납 패턴)
server_account = w3.eth.account.from_key(os.getenv('PRIVATE_KEY'))
try:
txn = voting_contract.functions.vote(candidate_index).build_transaction({
'from': server_account.address,
'nonce': w3.eth.get_transaction_count(server_account.address),
'gas': 100000,
'gasPrice': w3.eth.gas_price,
'chainId': 11155111
})
signed_txn = w3.eth.account.sign_transaction(txn, os.getenv('PRIVATE_KEY'))
tx_hash = w3.eth.send_raw_transaction(signed_txn.raw_transaction)
return jsonify({
'success': True,
'txHash': tx_hash.hex(),
'message': '투표가 성공적으로 처리되었습니다'
})
except Exception as e:
return jsonify({'error': str(e)}), 500
@app.route('/api/balance/<address>', methods=['GET'])
def get_balance(address):
"""ETH 잔액 조회"""
try:
# 주소 유효성 검사
if not w3.is_address(address):
return jsonify({'error': '잘못된 이더리움 주소'}), 400
balance_wei = w3.eth.get_balance(address)
balance_eth = float(w3.from_wei(balance_wei, 'ether'))
return jsonify({
'address': address,
'balance_eth': balance_eth,
'balance_wei': str(balance_wei)
})
except Exception as e:
return jsonify({'error': str(e)}), 500
@app.route('/api/transaction/<tx_hash>', methods=['GET'])
def get_transaction(tx_hash):
"""트랜잭션 정보 조회"""
try:
tx = w3.eth.get_transaction(tx_hash)
receipt = w3.eth.get_transaction_receipt(tx_hash)
return jsonify({
'hash': tx_hash,
'from': tx['from'],
'to': tx['to'],
'value_eth': float(w3.from_wei(tx['value'], 'ether')),
'gasUsed': receipt['gasUsed'],
'status': 'success' if receipt['status'] == 1 else 'failed',
'blockNumber': receipt['blockNumber']
})
except Exception as e:
return jsonify({'error': str(e)}), 500
if __name__ == '__main__':
print("🚀 DApp 백엔드 서버 시작!")
print(f"블록체인 연결: {'✅' if w3.is_connected() else '❌'}")
app.run(debug=True, port=5000)
사용자는 서명만 하고, 서버가 실제 트랜잭션을 보내는 방식이야.
사용자가 ETH 없이도 DApp을 쓸 수 있게 해주는 UX 개선 기법이야.
단, 서버 계정에 충분한 ETH가 있어야 하고, 보안에 더 신경 써야 해.
Web3.py는 단순히 트랜잭션을 보내는 것 외에도 블록체인 데이터를 분석하는 데도 강력해.
온체인 데이터 분석은 DeFi 프로토콜 모니터링, 지갑 추적, 시장 분석 등에 활용돼.
from web3 import Web3
import os
from dotenv import load_dotenv
from collections import defaultdict
import time
load_dotenv()
w3 = Web3(Web3.HTTPProvider(f"https://mainnet.infura.io/v3/{os.getenv('INFURA_API_KEY')}"))
def analyze_block(block_number):
"""특정 블록의 트랜잭션 분석"""
block = w3.eth.get_block(block_number, full_transactions=True)
total_eth = 0
gas_used_total = 0
address_activity = defaultdict(int)
print(f"\n=== 블록 #{block_number} 분석 ===")
print(f"트랜잭션 수: {len(block.transactions)}")
print(f"타임스탬프: {block.timestamp}")
print(f"채굴자/검증자: {block.get('miner', block.get('feeRecipient', 'N/A'))}")
for tx in block.transactions:
total_eth += tx.value
gas_used_total += tx.gas
if tx['from']:
address_activity[tx['from']] += 1
if tx['to']:
address_activity[tx['to']] += 1
print(f"총 ETH 이동량: {w3.from_wei(total_eth, 'ether'):.4f} ETH")
print(f"총 가스 한도: {gas_used_total:,}")
# 가장 활발한 주소 Top 5
top_addresses = sorted(address_activity.items(), key=lambda x: x[1], reverse=True)[:5]
print("\n가장 활발한 주소 Top 5:")
for addr, count in top_addresses:
print(f" {addr[:10]}...{addr[-6:]}: {count}회")
return {
'block_number': block_number,
'tx_count': len(block.transactions),
'total_eth': float(w3.from_wei(total_eth, 'ether')),
'gas_used': gas_used_total
}
def track_whale_wallet(address, block_count=10):
"""특정 지갑의 최근 활동 추적"""
print(f"\n=== 지갑 추적: {address[:10]}... ===")
current_block = w3.eth.block_number
transactions_found = []
print(f"최근 {block_count}개 블록 스캔 중...")
for block_num in range(current_block - block_count, current_block + 1):
block = w3.eth.get_block(block_num, full_transactions=True)
for tx in block.transactions:
if (tx['from'] and tx['from'].lower() == address.lower()) or \
(tx['to'] and tx['to'].lower() == address.lower()):
transactions_found.append({
'hash': tx.hash.hex(),
'block': block_num,
'from': tx['from'],
'to': tx['to'],
'value': float(w3.from_wei(tx.value, 'ether'))
})
print(f"발견된 트랜잭션: {len(transactions_found)}개")
for tx in transactions_found:
direction = "→ 송금" if tx['from'].lower() == address.lower() else "← 수신"
print(f" {direction} {tx['value']:.4f} ETH (블록 #{tx['block']})")
return transactions_found
# 최신 블록 분석
latest = w3.eth.block_number
analyze_block(latest)
# 특정 주소 추적 (예시: Vitalik Buterin의 공개 주소)
vitalik = "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045"
track_whale_wallet(vitalik, block_count=5)
DApp 개발에서 보안은 정말 중요해. 한번 배포된 컨트랙트는 수정이 어렵고,
취약점이 있으면 실제 자산 피해로 이어질 수 있거든.
꼭 알아야 할 보안 사항들을 정리해줄게.
| 취약점 | 설명 | 방어 방법 |
|---|---|---|
| 재진입 공격 (Reentrancy) |
외부 컨트랙트 호출 중 상태 변경 전에 재호출되는 공격. DAO 해킹 사례. | Checks-Effects-Interactions 패턴, ReentrancyGuard 사용 |
| 정수 오버플로우 | uint256 최대값 초과 시 0으로 돌아가는 문제 | Solidity 0.8.0+ 자동 체크, SafeMath 라이브러리 |
| 프론트러닝 | 멤풀에서 트랜잭션 내용을 보고 먼저 실행하는 공격 | Commit-Reveal 패턴, 슬리피지 설정 |
| 개인키 노출 | 코드에 개인키 하드코딩 | 환경변수, HSM, 키 관리 서비스 사용 |
| 접근 제어 미흡 | 중요 함수에 권한 체크 없음 | require/modifier로 권한 검증, OpenZeppelin Ownable |
from web3 import Web3
import os
from dotenv import load_dotenv
load_dotenv()
w3 = Web3(Web3.HTTPProvider(f"https://sepolia.infura.io/v3/{os.getenv('INFURA_API_KEY')}"))
# ===== 안전한 주소 검증 =====
def validate_address(address):
"""이더리움 주소 유효성 검증"""
if not w3.is_address(address):
raise ValueError(f"잘못된 이더리움 주소: {address}")
# 체크섬 주소로 변환 (대소문자 구분 검증)
checksum_address = w3.to_checksum_address(address)
return checksum_address
# ===== 안전한 트랜잭션 전송 =====
def safe_send_transaction(to_address, value_eth, private_key, max_retries=3):
"""재시도 로직이 포함된 안전한 트랜잭션 전송"""
# 주소 검증
to_address = validate_address(to_address)
account = w3.eth.account.from_key(private_key)
for attempt in range(max_retries):
try:
# 현재 가스 가격 조회
gas_price = w3.eth.gas_price
# 가스 가격이 너무 높으면 경고
gas_price_gwei = w3.from_wei(gas_price, 'gwei')
if gas_price_gwei > 100:
print(f"⚠️ 가스 가격이 높습니다: {gas_price_gwei:.2f} Gwei")
user_confirm = input("계속 진행하시겠습니까? (y/n): ")
if user_confirm.lower() != 'y':
return None
# 잔액 확인
balance = w3.eth.get_balance(account.address)
required = w3.to_wei(value_eth, 'ether') + (21000 * gas_price)
if balance < required:
raise ValueError(f"잔액 부족! 필요: {w3.from_wei(required, 'ether'):.6f} ETH")
# 트랜잭션 구성 및 전송
txn = {
'nonce': w3.eth.get_transaction_count(account.address),
'to': to_address,
'value': w3.to_wei(value_eth, 'ether'),
'gas': 21000,
'gasPrice': gas_price,
'chainId': 11155111
}
signed = w3.eth.account.sign_transaction(txn, private_key)
tx_hash = w3.eth.send_raw_transaction(signed.raw_transaction)
print(f"✅ 트랜잭션 전송 성공: {tx_hash.hex()}")
return tx_hash
except Exception as e:
print(f"❌ 시도 {attempt + 1}/{max_retries} 실패: {e}")
if attempt < max_retries - 1:
import time
time.sleep(2 ** attempt) # 지수 백오프
return None
# ===== 트랜잭션 시뮬레이션 =====
def simulate_transaction(contract, function_name, args, from_address):
"""실제 전송 전 트랜잭션 시뮬레이션"""
try:
func = getattr(contract.functions, function_name)
# call()로 시뮬레이션 (실제 상태 변경 없음)
result = func(*args).call({'from': from_address})
# 가스 추정
estimated_gas = func(*args).estimate_gas({'from': from_address})
print(f"✅ 시뮬레이션 성공!")
print(f" 예상 결과: {result}")
print(f" 예상 가스: {estimated_gas:,}")
return True, estimated_gas
except Exception as e:
print(f"❌ 시뮬레이션 실패: {e}")
return False, 0
DApp 개발을 더 효율적으로 하기 위한 도구들을 알아보자.
이 도구들을 잘 활용하면 개발 속도가 훨씬 빨라져!
| 카테고리 | 도구 | 용도 |
|---|---|---|
| 로컬 개발 환경 | Hardhat, Ganache | 로컬 이더리움 네트워크 시뮬레이션 |
| 컨트랙트 개발 | Remix IDE, Foundry | Solidity 코드 작성, 컴파일, 테스트 |
| 노드 서비스 | Infura, Alchemy, QuickNode | 이더리움 노드 API 제공 |
| 블록 탐색기 | Etherscan, Blockscout | 트랜잭션, 컨트랙트 조회 |
| 테스트 이더 | Sepolia Faucet, Goerli Faucet | 테스트넷 이더 무료 지급 |
| 컨트랙트 라이브러리 | OpenZeppelin | 검증된 ERC 표준 구현체 |
| Python 라이브러리 | Web3.py, eth-brownie, ape | Python 블록체인 개발 프레임워크 |
| 지갑 | MetaMask, WalletConnect | 사용자 지갑 연동 |
Web3.py가 저수준 라이브러리라면, Brownie는 Python 기반 고수준 DApp 개발 프레임워크야.
Hardhat의 Python 버전이라고 생각하면 돼.
# Brownie 설치
pip install eth-brownie
# 새 프로젝트 생성
brownie init my_dapp
cd my_dapp
# 프로젝트 구조
# contracts/ - Solidity 파일
# scripts/ - 배포 스크립트
# tests/ - 테스트 파일
# build/ - 컴파일 결과물
# 컴파일
brownie compile
# 로컬 테스트넷에서 스크립트 실행
brownie run scripts/deploy.py
# 테스트 실행
brownie test
# Sepolia 테스트넷에 배포
brownie run scripts/deploy.py --network sepolia
from brownie import SimpleStorage, accounts, network
def main():
# 현재 네트워크 확인
print(f"현재 네트워크: {network.show_active()}")
# 계정 선택
if network.show_active() == "development":
# 로컬 개발 환경: 테스트 계정 사용
deployer = accounts[0]
else:
# 실제 네트워크: 환경변수에서 계정 로드
deployer = accounts.load("my_account")
print(f"배포 계정: {deployer.address}")
print(f"잔액: {deployer.balance()} Wei")
# 컨트랙트 배포
contract = SimpleStorage.deploy({'from': deployer})
print(f"✅ 배포 완료!")
print(f"컨트랙트 주소: {contract.address}")
# 함수 호출 테스트
contract.setValue(100, {'from': deployer})
value = contract.getValue()
print(f"저장된 값: {value}")
return contract
마지막으로 DApp 개발하면서 자주 만나는 문제들과 해결책을 정리해줄게.
이거 알면 삽질 시간을 엄청 줄일 수 있어! 😄
해결책:
w3.eth.get_transaction_count(address, 'pending')으로 펜딩 포함 논스 조회하거나,논스를 직접 관리하는 카운터를 만들어.
해결책:
estimate_gas()로 예상 가스를 구하고 1.2~1.5배 여유를 줘.
해결책: 항상 연결된 네트워크의 체인 ID를
w3.eth.chain_id로 확인해.
트랜잭션 영수증에서 이벤트 로그를 파싱하려면:
receipt = contract.events.MyEvent().process_receipt(tx_receipt)이렇게 하면 이벤트 데이터를 깔끔하게 파싱할 수 있어.
여러 조회를 한 번의 RPC 호출로 처리할 수 있어.
web3-multicall 라이브러리 참고.
get_logs(from_block=0)는 전체 블록을 스캔해서 느려.특정 블록 범위를 지정하거나, 인덱스된 이벤트 파라미터로 필터링해서 속도를 높여.
스마트 컨트랙트 개발, Web3.py 연동, DApp 풀스택 개발 등 다양한 재능을 가진 개발자들이 있으니까
프로젝트에 맞는 전문가와 협업해보는 것도 좋은 방법이야! 🤝
와, 여기까지 따라왔다면 진짜 대단해! 👏
오늘 우리가 다룬 내용을 정리해볼게.
1DApp 개념 — 탈중앙화 앱이 뭔지, 일반 앱과 뭐가 다른지
2개발 환경 세팅 — Web3.py 설치, Infura 연결, 환경변수 관리
3Web3.py 기초 — 연결, 잔액 조회, 블록 정보, 트랜잭션 전송
4스마트 컨트랙트 — Solidity 작성, 컴파일, 배포, 상호작용
5ERC-20 토큰 — 토큰 표준 이해, 나만의 토큰 만들기
6실전 DApp — 투표 시스템, Flask 백엔드 API
7계정 관리 — 지갑 생성, 메시지 서명, 키스토어
8가스 최적화 — EIP-1559, 가스 추정, 비용 절감
9보안 — 주요 취약점과 방어 패턴
10개발 도구 — Brownie, Hardhat, OpenZeppelin 생태계
다음 단계로 나아가고 싶다면 이런 것들을 공부해봐:
🔮 DeFi 프로토콜 개발 🖼️ NFT (ERC-721) 컨트랙트 🏛️ DAO 거버넌스 ⚡ Layer 2 (Polygon, Arbitrum) 🌉 크로스체인 브릿지 🔍 The Graph (온체인 데이터 인덱싱) 🛡️ 스마트 컨트랙트 감사(Audit) 📊 온체인 데이터 분석
블록체인 세계는 정말 빠르게 변하고 있어. 새로운 기술, 새로운 표준, 새로운 기회들이 계속 나오고 있거든.
Python과 Web3.py를 기반으로 탄탄하게 실력을 쌓으면, 이 변화하는 세계에서 충분히 경쟁력을 가질 수 있어.
재능넷에서도 블록체인 개발 관련 재능을 공유하거나 찾아볼 수 있으니, 커뮤니티를 적극 활용해봐! 🚀
자, 이제 코드 에디터 열고 직접 만들어봐. 이론보다 실전이 훨씬 빨리 늘거든! 💪
궁금한 거 있으면 언제든지 물어봐. 화이팅! 🎉
🐍 Python × ⛓️ Blockchain × 🌐 Web3.py = 🚀 DApp
탈중앙화의 미래를 Python으로 만들어가자!
댓글 작성
이 글에 대한 여러분의 생각을 들려주세요
로그인이 필요합니다
댓글을 작성하려면 먼저 로그인해주세요.
댓글 0
지식인의 숲 - 지적 재산권 보호 고지
지적 재산권 보호 고지
- 저작권 및 소유권: 본 컨텐츠는 재능넷의 독점 AI 기술로 생성되었으며, 대한민국 저작권법 및 국제 저작권 협약에 의해 보호됩니다.
- AI 생성 컨텐츠의 법적 지위: 본 AI 생성 컨텐츠는 재능넷의 지적 창작물로 인정되며, 관련 법규에 따라 저작권 보호를 받습니다.
- 사용 제한: 재능넷의 명시적 서면 동의 없이 본 컨텐츠를 복제, 수정, 배포, 또는 상업적으로 활용하는 행위는 엄격히 금지됩니다.
- 데이터 수집 금지: 본 컨텐츠에 대한 무단 스크래핑, 크롤링, 및 자동화된 데이터 수집은 법적 제재의 대상이 됩니다.
- AI 학습 제한: 재능넷의 AI 생성 컨텐츠를 타 AI 모델 학습에 무단 사용하는 행위는 금지되며, 이는 지적 재산권 침해로 간주됩니다.
아직 댓글이 없습니다.