{"id":19400747,"url":"https://github.com/mypttwo/scd","last_synced_at":"2025-11-18T02:03:17.430Z","repository":{"id":255634388,"uuid":"123543735","full_name":"mypttwo/scd","owner":"mypttwo","description":"Deploy smart contracts without running a local geth node using web3 1.0.0 and nodejs.","archived":false,"fork":false,"pushed_at":"2018-03-02T07:25:13.000Z","size":42,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-24T23:41:36.661Z","etag":null,"topics":["dapp-example","ethereum-contract","infura","node-js","smart-contracts","web3js"],"latest_commit_sha":null,"homepage":null,"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/mypttwo.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-03-02T07:09:06.000Z","updated_at":"2022-01-07T03:30:32.000Z","dependencies_parsed_at":"2024-09-06T12:28:40.285Z","dependency_job_id":"71e39d5a-2bd0-44e0-8324-68a69245f99d","html_url":"https://github.com/mypttwo/scd","commit_stats":null,"previous_names":["mypttwo/scd"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/mypttwo/scd","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mypttwo%2Fscd","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mypttwo%2Fscd/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mypttwo%2Fscd/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mypttwo%2Fscd/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mypttwo","download_url":"https://codeload.github.com/mypttwo/scd/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mypttwo%2Fscd/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":284988465,"owners_count":27095952,"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","status":"online","status_checked_at":"2025-11-18T02:00:05.759Z","response_time":61,"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":["dapp-example","ethereum-contract","infura","node-js","smart-contracts","web3js"],"created_at":"2024-11-10T11:15:51.469Z","updated_at":"2025-11-18T02:03:17.414Z","avatar_url":"https://github.com/mypttwo.png","language":"JavaScript","readme":"# Simple Smart Contract Deployer\n\nDeploy Ethreum smart contracts without running a local geth node using [web3 1.0.0](https://web3js.readthedocs.io/en/1.0/) and [nodejs](https://nodejs.org/en/).\n\nYou will find this interesting if\n - you need a working example using [web3 1.0.0](https://web3js.readthedocs.io/en/1.0/). As of this doc checkin there is plenty of code on the web using [web3 0.x.x](https://github.com/ethereum/wiki/wiki/JavaScript-API) but I couldn't find a complete working example using web3 1.0.0. (Maybe I didn't look hard enough!)\n - you do not want to run a local node - either to connect to [Ropsten](https://ropsten.etherscan.io/)/[Rinkeby](https://rinkeby.etherscan.io/) or even [testrpc/ganache](http://truffleframework.com/ganache/) .   \n\nDisclaimers :  \n\n 1. This is not production code and is not secure. It also does not follow best practices for nodejs app development. This is simply an example - deliberately stripped down for clarity. \n 2. The simpler way to deploy the contract is to use [truffle console](#using-truffle-console) of course. This only demonstrates a way it can be done via nodejs. \n\n## Getting Started\n\nApart from having nodejs installed and other usual stuff you will need to \n - Signup on [infura.io](https://infura.io/). This is the infrastructure that powers [Metamask](https://metamask.io/). You should have an **API key** at the end of the signup.\n - Install [Metamask](https://metamask.io/) if you have not done that as yet. This will give you a **default account and a [mnemonic](https://en.bitcoin.it/wiki/Mnemonic_phrase)** to login. \n - Get some **ether** to begin with.  You would also like to work with a *test* network like [Ropsten](https://ropsten.etherscan.io/) or [Rinkeby](https://rinkeby.etherscan.io/). Look for faucets in the respective networks - like [Ropsten faucet](http://faucet.ropsten.be:3001/), [Rinkeby faucet](https://faucet.rinkeby.io/).\n\n## Running the code\n\n - The code includes a **.env** file. You will need to set the appropriate variables like so.\n\n    ``INFURA_URL_API_KEY=https://ropsten.infura.io/1t7lIne9gTwmPs9Twsd5``\u003cbr/\u003e\n    ``MNEMONIC=one two three four five six seven eight nine ten eleven twelve``\n\n*Needless to say the above file should never be checked in or even logged. If you do that in production you will be robbed.*\n\n - The code includes a **setup.js** where you can specify \n\t - the path and name of the .sol file containing the Contract.\n\t - the name of the Contract itself\n\t - the arguments for the Contract\n\nThe code uses the [Voting Contract](https://gist.github.com/maheshmurthy/3da385a42678c3e36a8328cbe47cae5b#file-voting-sol) by [Mahesh Murthy](https://medium.com/@mvmurthy) as an example. \n\n - Finally you run the code like so\n\u003e  ``node app.js``\n\n## Output\n\nThe example simply \n - connects to the infura endpoint with the mnemonic as credentials\n - gets the first account you see on Metamask (only the first is returned anyway even if multiple accounts are available)\n - dynamically compiles the Contract and extracts the [abi](https://solidity.readthedocs.io/en/develop/abi-spec.html) and the bytecode\n - estimates the [gas](https://media.consensys.net/ethereum-gas-fuel-and-fees-3333e17fe1dc) required for deploying the Contract (this is not accurate; we add some more gas later as you would see in the code)\n - and finally deploys the Contract.\n\nIts also possible that an error may result even if all works well. \n\n\u003e ``Error: Transaction was not mined within 50 blocks, please make sure your transaction was properly sent. Be aware that it might still be mined!``\n\n You can view the results on [etherscan](https://etherscan.io/) via Metamask.\n\n## Using truffle console\n\nIn case you want to connect via truffle console you will need to run\n\n\u003e ``truffle console --network remote``\n\n## Acknowledgements\n\n - Excellent [tutorials](https://github.com/maheshmurthy/ethereum_voting_dapp) by [Mahesh Murthy](https://medium.com/@mvmurthy)  \n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmypttwo%2Fscd","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmypttwo%2Fscd","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmypttwo%2Fscd/lists"}