{"id":20974341,"url":"https://github.com/thirdweb-example/solidity-hello-world","last_synced_at":"2025-05-14T12:31:54.243Z","repository":{"id":41393118,"uuid":"503559146","full_name":"thirdweb-example/solidity-hello-world","owner":"thirdweb-example","description":"Build and deploy a simple hello world smart contract using our contract kit!","archived":false,"fork":false,"pushed_at":"2022-10-26T20:54:40.000Z","size":685,"stargazers_count":2,"open_issues_count":0,"forks_count":3,"subscribers_count":2,"default_branch":"main","last_synced_at":"2023-03-04T18:10:55.098Z","etag":null,"topics":["blockchain","contract-kit","ethereum","extensions","solidity","thirdweb-deploy"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/thirdweb-example.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-06-15T00:12:56.000Z","updated_at":"2023-01-02T21:14:25.000Z","dependencies_parsed_at":"2023-01-20T01:18:13.910Z","dependency_job_id":null,"html_url":"https://github.com/thirdweb-example/solidity-hello-world","commit_stats":null,"previous_names":[],"tags_count":null,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thirdweb-example%2Fsolidity-hello-world","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thirdweb-example%2Fsolidity-hello-world/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thirdweb-example%2Fsolidity-hello-world/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thirdweb-example%2Fsolidity-hello-world/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thirdweb-example","download_url":"https://codeload.github.com/thirdweb-example/solidity-hello-world/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225294829,"owners_count":17451566,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["blockchain","contract-kit","ethereum","extensions","solidity","thirdweb-deploy"],"created_at":"2024-11-19T04:28:28.142Z","updated_at":"2024-11-19T04:28:29.159Z","avatar_url":"https://github.com/thirdweb-example.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003c!-- Banner Image --\u003e\n\n![thirdweb solidity hardhat get started hero image](hero.png)\n\n\u003ch1 align='center'\u003eGet Started with Solidity!\u003c/h1\u003e\n\n\u003cp align='center'\u003eThis template showcases a basic Solidity smart contract with a full development and deployment environment set up.\u003c/p\u003e\n\n\u003cbr /\u003e\n\n\u003cb\u003eTools used in this template: \u003c/b\u003e\n\n[Solidity](https://docs.soliditylang.org/en/v0.8.14/) for the development language of our smart contract\n\n[Hardhat](https://hardhat.org/) for the development environment (testing, debugging, etc.)\n\n[thirdweb deploy](https://portal.thirdweb.com/thirdweb-deploy) to deploy the contract to the blockchain without using a private key\n\n\u003cbr /\u003e\n\n\u003cb\u003eKey Commands: \u003c/b\u003e\n\n`npx thirdweb deploy`: Deploy the smart contract\n\n`npx hardhat test`: Run the test suite (unit tests)\n\n\u003cbr /\u003e\n\n\u003ch2 align='center'\u003eHow to use this template\u003c/h2\u003e\n\n\u003ch3 align='left'\u003e\u003cb\u003eExploring the Smart Contract\u003c/b\u003e\u003c/h3\u003e\n\nTake a look at the [`Greeter.sol`](./contracts/Greeter.sol) file, you'll find a smart contract!\n\nIt's very basic, but it's a great starting point to explain how to build, test, and deploy smart contracts using Solidity.\n\nFirstly, we declare our contract's [License](https://spdx.org/licenses/) and [Solidity Version](https://github.com/ethereum/solidity/releases).\n\n```solidity\n// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n```\n\nThen, we define our first `contract`, called `Greeter`!\n\nA `contract` is a smart contract, which is a collection containing:\n\n1. Functions\n2. Data / State\n\nThat live at a specific address on the blockchain.\n\n```solidity\ncontract Greeter {\n\n}\n```\n\nWe define a `variable` (data) called `greeting`, which is a `private` `string`.\n\nThis just means it is not publicly accessible by other contracts or users.\n\n```solidity\nstring private greeting;\n```\n\nThe `constructor` is what gets called when the contract is first created.\n\nWhen we deploy the contract, we'll let the contract know what the initial value of the `greeting` variable is, by passing in a `string` as an argument and setting the value of `greeting` to that string.\n\n```\nconstructor(string memory _greeting) {\n    greeting = _greeting;\n}\n```\n\nSince we made our `greeting` variable `private`, we can write a `view` that reads and returns the value of the `greeting` variable.\n\nSince this is `public`, it can be accessed by other contracts or users. You'll also notice the `view` keyword, which means this function will not modify any state or data in our contract; it simply just returns some data to the caller.\n\n```solidity\nfunction greet() public view returns (string memory) {\n    return greeting;\n}\n```\n\nFinally, we have a `function` called `setGreeting`, which takes in a `string` as an argument and sets the value of `greeting` to that string.\n\nThis allows a user to change the value of `greeting` to something else.\n\n```solidity\nfunction setGreeting(string memory _greeting) public {\n    greeting = _greeting;\n}\n```\n\n\u003ch3 align='left'\u003e\u003cb\u003eDeploying the smart contract\u003c/b\u003e\u003c/h3\u003e\n\nTo deploy the contract to the blockchain, run the below script:\n\n```bash\nnpx thirdweb deploy\n```\n\nThis command uses [thirdweb deploy](https://portal.thirdweb.com/thirdweb-deploy) to:\n\n1. Compile your smart contract and detect any errors\n2. Upload the contract ABI to IPFS\n3. Generate a URL to deploy the contract on the thirdweb dashboard.\n\n\u003ch3 align='left'\u003e\u003cb\u003eTesting the Contract\u003c/b\u003e\u003c/h3\u003e\n\nTo run the test suite and see if your contract works as you expect, run the below script:\n\n```bash\nnpx hardhat test\n```\n\n## What's Next\n\nTo build a web-app application using this smart contract, check out our next template, [\"Build a web3 application using thirdweb\"](https://replit.com/@thirdweb/Build-a-web3-Application-using-thirdweb)!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthirdweb-example%2Fsolidity-hello-world","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthirdweb-example%2Fsolidity-hello-world","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthirdweb-example%2Fsolidity-hello-world/lists"}