Skip to content

Instantly share code, notes, and snippets.

@arturmartins
Created July 14, 2023 16:04
Show Gist options
  • Save arturmartins/02abf10a5dd87dde36ad7c15c72d6e0f to your computer and use it in GitHub Desktop.
Save arturmartins/02abf10a5dd87dde36ad7c15c72d6e0f to your computer and use it in GitHub Desktop.
Ethereum Smart Contract - HelloWorld example
// SPDX-License-Identifier: MIT
pragma solidity 0.8.20;
// This defines a contract named “HelloWorld”.
//
// A contract is a collection of functions and data (its state).
// Once deployed, a contract will exist at an address on the Ethereum blockchain.
contract HelloWorld {
// This is a public function that returns the string “Hello World”.
// It is declared pure because it doesn’t read or modify the blockchain state.
function sayHelloWorld() public pure returns (string memory) {
return "Hello World";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment