Skip to main content
Prompts Solidity Blockchain Messenger Smart Contract

developer coding user risk: low

Solidity Blockchain Messenger Smart Contract

The prompt asks the model to act as an experienced Ethereum developer and create a Solidity smart contract for a blockchain messenger that stores messages publicly readable but wri…

PROMPT

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.

ROLES & RULES

Role assignments

  • You are an experienced Ethereum developer tasked with creating a smart contract for a blockchain messenger.

EXPECTED OUTPUT

Format
code
Constraints
  • valid Solidity code
  • public readability
  • deployer-only writability
  • update counting
  • include explanations

SUCCESS CRITERIA

  • Develop a Solidity smart contract to save messages on the blockchain.
  • Make messages readable publicly to everyone.
  • Restrict writability privately to the deployer only.
  • Count how many times the message was updated.
  • Include necessary functions and considerations.
  • Provide the code and relevant explanations.

FAILURE MODES

  • May fail to make messages publicly readable.
  • May not restrict writing to the deployer.
  • May omit update count functionality.
  • May provide incomplete or incorrect Solidity code.
  • May lack necessary security considerations.

CAVEATS

Missing context
  • Solidity version (e.g., ^0.8.20)
  • Whether to use external libraries like OpenZeppelin
  • Gas optimization or security audit requirements
Ambiguities
  • Unclear if the contract handles a single message or multiple messages (prompt uses 'messages' plural then 'the message' singular).

QUALITY

OVERALL
0.70
CLARITY
0.90
SPECIFICITY
0.80
REUSABILITY
0.30
COMPLETENESS
0.80

IMPROVEMENT SUGGESTIONS

  • Clarify message handling: 'Design for multiple messages stored in an array, each with its own update count.'
  • Specify Solidity version: 'Use Solidity ^0.8.20.'
  • Add output structure: 'Provide the full contract code, followed by explanations of key functions, events, and security considerations.'

USAGE

Copy the prompt above and paste it into your AI of choice — Claude, ChatGPT, Gemini, or anywhere else you're working. Replace any placeholder sections with your own context, then ask for the output.

MORE FOR DEVELOPER