이더리움 스마트 솔리디티 개발
블록체인 메신저용 솔리디티 스마트 컨트랙트 로직과 코드를 한 번에 작성합니다.
- 추천 툴
- ClaudeAI 분류
- 쓰인 기법
- 역할 부여 · 요구사항 상세화
프롬프트 원문
Imagine you are an experienced Ethereum developer tasked with creating a smart contract for a blockchain messenger. The objective is to save messages on the blockchain, making them readable (public) to everyone, writable (private) only to the person who deployed the contract, and to count how many times the message was updated. Develop a Solidity smart contract for this purpose, including the necessary functions and considerations for achieving the specified goals. Please provide the code and any relevant explanations to ensure a clear understanding of the implementation.
한국어 풀이 보기(참고용)
당신이 블록체인 메신저용 스마트 컨트랙트를 제작하는 숙련된 이더리움 개발자라고 가정해 보세요. 목표는 블록체인에 메시지를 저장하여 누구나 읽을 수 있게(공개) 하고, 작성(수정)은 컨트랙트를 배포한 사람만 가능하게(비공개) 하며, 메시지가 업데이트된 횟수를 카운트하는 것입니다. 지정된 목표를 달성하기 위해 필요한 기능과 고려사항을 포함하여 이를 위한 Solidity 스마트 컨트랙트를 개발해 주세요. 구현 방식을 명확히 이해할 수 있도록 코드와 관련 설명을 함께 제공해 주세요.
- 활용Solidity 버전 지정이나 가스비 최적화 조건 요구를 추가하면 더 완성도 높은 코드가 나옵니다.
- 활용코드와 함께 보안 취약점 점검을 추가로 요구할 수 있습니다.
출처 · prompts.chat · Ethereum Developer — 원문은 출처에 게시된 그대로이며, 권리는 원작자에게 있습니다.
텍스트 결과
Gemini로 실행한 결과입니다. 입력 항목에는 국내 환경의 예시값을 적용했습니다(AI 생성 — 사실 확인 필요).
실행 입력값 보기
Imagine you are an experienced Ethereum developer tasked with creating a smart contract for a blockchain messenger. The objective is to save messages on the blockchain, making them readable (public) to everyone, writable (private) only to the person who deployed the contract, and to count how many times the message was updated. Develop a Solidity smart contract for this purpose, including the necessary functions and considerations for achieving the specified goals. Please provide the code and any relevant explanations to ensure a clear understanding of the implementation.
요구사항을 충족하는 Solidity 스마트 컨트랙트 구현 예시입니다.
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
contract BlockchainMessenger {
address public immutable owner;
string public message;
uint256 public updateCount;
event MessageUpdated(string newMessage, uint256 count);
modifier onlyOwner() {
require(msg.sender == owner, "Not authorized: Only owner can update");
_;
}
constructor(string memory initialMessage) {
owner = msg.sender;
message = initialMessage;
updateCount = 0;
}
function setMessage(string memory newMessage) public onlyOwner {
message = newMessage;
updateCount++;
emit MessageUpdated(newMessage, updateCount);
}
}핵심 설명
- 소유권 지정 (`owner`):
constructor에서 컨트랙트를 배포한 계정(msg.sender)을owner로 설정합니다.immutable키워드로 변조를 방지합니다. - 공개 읽기 (`public`):
message와updateCount를public으로 선언하여 누구나 블록체인에서 비용(Gas) 없이 조회할 수 있습니다. - 작성 권한 제한 (`onlyOwner`):
setMessage함수에onlyOwner커스텀 modifier를 적용해 배포자만 메시지를 수정할 수 있도록 제한합니다. - 업데이트 횟수 추적:
setMessage가 호출될 때마다updateCount를 1씩 증가시키고 이벤트를 알립니다.
mopick 개선안
원문을 더 잘 동작하게 고쳐 쓴 프롬프트
원문을 그대로 넣으면 AI 가 매번 다르게 답하거나 중요한 부분을 빠뜨릴 수 있습니다. 개선안은 원문의 뜻과 언어는 그대로 두고 역할 · 바꿔 넣을 입력 칸 · 결과 형식 · 지킬 조건을 보완해 다시 쓴 버전입니다. 원문과 같은 곳(ChatGPT · Claude 등)에 그대로 붙여 넣어 쓰면 됩니다.
AI 자체 평가 — 개선안을 쓴 AI 가 명확성 · 구체성 · 결과 형식 · 재사용성 기준(100점)으로 직접 매긴 점수 · 결과를 돌려 검증한 값은 아님
원문의 문제 → 개선안에서 고친 점
AI 역할레슨 01 배우기 ›
원문 · 없음AI 에게 맡길 역할이 정해져 있지 않아 답의 관점 · 수준이 그때그때 달라질 수 있었습니다.
개선 · 역할을 정함Act as a senior Ethereum developer. Write a production-ready Solidity ([e.g., ^0.8.20]) sm
입력 칸레슨 05 배우기 ›
원문 · 없음바꿔 넣을 자리가 표시돼 있지 않아 쓸 때마다 원문을 직접 고쳐야 했습니다.
개선 · 1개[e.g., ^0.8.20]
작업 순서레슨 07 배우기 ›
원문 · 없음작업 순서가 정해져 있지 않아 AI 가 순서를 스스로 정해야 했습니다.
개선 · 5단계
고친 이유 (개선안을 만든 AI 의 설명)
- 1Solidity 버전 및 이벤트 발행 명세 추가
- 2접근 제어 모디파이어 등 구현 제약조건 보강
- 3코드와 기술 설명의 출력 구조를 명확히 세분화
이 개선안에 쓰인 기법 — 프롬프트 클래스에서 배우기
01역할 정하기03결과 모양 정하기04지킬 조건 걸기05입력 칸으로 템플릿 만들기07작업을 단계로 나누기09구역을 나눠 쓰기
원문
Imagine you are an experienced Ethereum developer tasked with creating a smart contract for a blockchain messenger. The objective is to save messages on the blockchain, making them readable (public) to everyone, writable (private) only to the person who deployed the contract, and to count how many times the message was updated. Develop a Solidity smart contract for this purpose, including the necessary functions and considerations for achieving the specified goals. Please provide the code and any relevant explanations to ensure a clear understanding of the implementation.
개선안 · 색칠한 [칸]에 내 내용을 넣어 쓰세요
Act as a senior Ethereum developer. Write a production-ready Solidity ([e.g., ^0.8.20]) smart contract for a blockchain messenger based on these specifications: ### Requirements: 1. State Management: Store a publicly readable message and track the total update count. 2. Access Control: Only the contract deployer (owner) can modify the message. 3. Event Logging: Emit an event whenever the message is updated. ### Constraints & Best Practices: - Use custom errors or modifiers for access restriction. - Add NatSpec comments for clarity. ### Output Format: 1. **Solidity Smart Contract**: Complete, compilable code block including SPDX license and pragma statement. 2. **Technical Breakdown**: Explanation of state variables, access control implementation, and event structure.
같은 분야 프롬프트 코딩 · 개발
더 보기 ›- 텍스트 결과
코딩 · 개발 · Claude Code
전체 코드 버그 종합 분석
프로젝트 코드 전체의 보안 취약점과 로직 오류를 체계적으로 분석하고 수정 보고서를 만듭니다.
기법 · 역할 부여 · 단계별 사고 · 출력 형식 지정
- 텍스트 결과
코딩 · 개발 · Claude Code
레트로 게임 AI 코딩 연출
AI로 웹 게임 개발 시 불필요한 텍스트 연출을 막고 레트로 사운드와 UI를 깔끔하게 구현합니다.
기법 · 네가티브 제약
- 웹 화면(HTML)텍스트 결과
코딩 · 개발 · 공통
공장 AI HMI 시뮬레이터 제작
공장 작업자의 AI 시스템 대응 교육용 단일 HTML 웹 HMI 시뮬레이터를 즉시 구축할 때 활용합니다.
기법 · 역할 부여 · 단계별 지시 · 출력 형식 지정

