{"id":23235321,"url":"https://github.com/marcosrachid/ethereum-sc-example-1","last_synced_at":"2026-05-02T05:41:52.708Z","repository":{"id":130888038,"uuid":"155091057","full_name":"marcosrachid/ethereum-sc-example-1","owner":"marcosrachid","description":"Practical ethereum smart contract example","archived":false,"fork":false,"pushed_at":"2018-11-12T23:46:31.000Z","size":16,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-06-05T06:57:50.674Z","etag":null,"topics":["ethereum","ethereum-sc","example","smart-contract","smart-contracts","solidity"],"latest_commit_sha":null,"homepage":null,"language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/marcosrachid.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2018-10-28T16:23:48.000Z","updated_at":"2018-11-12T23:49:14.000Z","dependencies_parsed_at":null,"dependency_job_id":"7b7305ea-68f8-4608-b9c9-0c147e99d164","html_url":"https://github.com/marcosrachid/ethereum-sc-example-1","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/marcosrachid/ethereum-sc-example-1","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcosrachid%2Fethereum-sc-example-1","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcosrachid%2Fethereum-sc-example-1/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcosrachid%2Fethereum-sc-example-1/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcosrachid%2Fethereum-sc-example-1/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/marcosrachid","download_url":"https://codeload.github.com/marcosrachid/ethereum-sc-example-1/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcosrachid%2Fethereum-sc-example-1/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32524565,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-02T01:12:54.858Z","status":"online","status_checked_at":"2026-05-02T02:00:05.923Z","response_time":132,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["ethereum","ethereum-sc","example","smart-contract","smart-contracts","solidity"],"created_at":"2024-12-19T03:20:32.961Z","updated_at":"2026-05-02T05:41:52.702Z","avatar_url":"https://github.com/marcosrachid.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# ethereum-sc-example-1\nPractical ethereum smart contract example\n\n## Function Structure\n\n```\nfunction (\u003cparameter types\u003e) {(visibility) internal|external}\n[pure|constant|view|payable][returns (\u003creturn types\u003e)]\n```\n\n## Types\n\n* bool: can be \"true\" or \"false\";\n* int or int256: is an integer 256 bits signed;\n* int8 to int256: from 8 to 8, is a signed integer with the referenced number of bits;\n* uint or uint256: is an integer 256 bits unsigned;\n* uint8 to uint256: from 8 to 8, is a unsigned integer with the referenced number of bits;\n* address: 20 bytes of information referenced to an ethereum account (like an object);\n  * balance: get account current balance;\n  * transfer: account receives an amount;\n  * call:  is a low-level interface for sending a message to a contract. It returns false if the subcall encounters an exception, otherwise it returns true(use not recommended);\n* string: text variable set between double quotes\n* arrays: declare arrays with type or struct declaration before \"[]\". To get any value within an array you need to declare variable with an index. Ex:\n```\nuint[] value;\n\nvalue[0];\nvalue[1];\nvalue[2];\n```\n* struct: definition of new types(similar to objects from classes, but always public atributes and no methods). Can be arrays or mappings. Ex:\n```\nstruct Lottery {\n  uint data;\n  uint luckyNumber;\n  address sender;\n}\n...\nLottery[] lotteries;\nlotteries[0].luckyNumber = 1234;\n```\n* mappings: key x value type with an arbitrary key to reference an specific value. Ex:\n```\nmapping(address =\u003e uint) balances;\n\nfunction update(uint balance) public {\n  balances[msg.sender] = balance;\n}\n```\n\n## Ether Units\n\n* wei: 1 == 1 wei;\n* szabo(miliether): 1 == 1,000,000,000,000(1e12) wei;\n* finney(microether): 1 == 1,000,000,000,000,000(1e15) wei;\n* ether: 1 == 1,000,000,000,000,000,000(1e18) wei.\n\n## Time Units\n\n* seconds: 1 == 1 seconds;\n* minutes: 1 == 60 seconds;\n* hours: 1 == 60 minutes;\n* days: 1 == 24 hours;\n* weeks: 1 == 7 days;\n* years: 1 == 365 days\n  * BEWARE: leap years.\n\n## Platform Properties\n\n* block.blockhash(uint blockNumber) returns (bytes32): hash from a block;\n* block.number(uint): actual block number;\n* block.timestamp(uint) or now(uint): actual block timestamp(in seconds);\n* gasleft() returns (uint256): lefting gas;\n* msg.sender(address): account address that called the contract;\n* msg.value(uint): amount of wei sent with the message.\n\nSource  | Data\n------------- | -------------\nLink  | \u003chttps://solidity.readthedocs.io/en/v0.4.25/units-and-global-variables.html#special-variables-and-functions\u003e\n\n## Visibility\n\n* public/external\n* private/internal\n\n## Modifiers\n\n* constant/view: Use the global variable and access within the function only. Scope only within the function;\n* pure: Only access local variable do not access the global variable;\n* payable: Modify the global variable (or) rewritte the global variable. Scope outside function used.\n\n## Source\n\nSource  | Data\n------------- | -------------\nAuthor  | ECOA PUCRIO\nInstructor I | Rafael Nasser\nInstructor II | Ronnie Paskin\nClass  | Contratos Inteligentes: Programação Solidity para Ethereum\nLink  | \u003chttps://www.udemy.com/curso-completo-do-desenvolvedor-nodejs\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarcosrachid%2Fethereum-sc-example-1","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmarcosrachid%2Fethereum-sc-example-1","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarcosrachid%2Fethereum-sc-example-1/lists"}