{"id":27874767,"url":"https://github.com/camerodev/how_to_deploy_contract-basic","last_synced_at":"2025-05-05T01:38:11.045Z","repository":{"id":227921283,"uuid":"772666042","full_name":"camerodev/how_to_deploy_contract-basic","owner":"camerodev","description":"smart contract deploy","archived":false,"fork":false,"pushed_at":"2024-03-15T16:39:45.000Z","size":306,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-07T16:43:27.487Z","etag":null,"topics":["blockchain","deployment","smart-contracts"],"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/camerodev.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}},"created_at":"2024-03-15T16:39:39.000Z","updated_at":"2024-03-15T18:13:47.000Z","dependencies_parsed_at":"2024-03-15T20:38:45.081Z","dependency_job_id":null,"html_url":"https://github.com/camerodev/how_to_deploy_contract-basic","commit_stats":null,"previous_names":["slickcharmer/how_to_deploy_contract-basic","camerodev/how_to_deploy_contract-basic"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/camerodev%2Fhow_to_deploy_contract-basic","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/camerodev%2Fhow_to_deploy_contract-basic/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/camerodev%2Fhow_to_deploy_contract-basic/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/camerodev%2Fhow_to_deploy_contract-basic/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/camerodev","download_url":"https://codeload.github.com/camerodev/how_to_deploy_contract-basic/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252424939,"owners_count":21745835,"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","deployment","smart-contracts"],"created_at":"2025-05-05T01:38:10.517Z","updated_at":"2025-05-05T01:38:11.022Z","avatar_url":"https://github.com/camerodev.png","language":"JavaScript","readme":"# How to deploy Contract on BSC testnet\n\n## 1.Set up Truffle\n```\nnpm install -g truffle\n```\nMake an empty repository, cd into it, then\n```\ntruffle init\n```\nInstall HDWalletProvider\n```\nnpm install --save truffle-hdwallet-provider\n```\n## 2. Create your contract\nIn ./contracts create a new contract called HelloWorld.sol with the following code:\n```\npragma solidity ^0.4.23;\ncontract HelloWorld {\n    function sayHello() public pure returns(string){\n        return(“hello world”);\n    }\n}\n```\n## 3. Deploy your contract\nIn ./migrations, create a deployment script specifically named 2_deploy_contracts.js with the following code:\n```\nvar HelloWorld = artifacts.require(“HelloWorld”);\nmodule.exports = function(deployer) {\n    deployer.deploy(HelloWorld, “hello”);\n    // Additional contracts can be deployed here\n};\n```\n## 4. Configure BSC testnet network and the provider\n```\nconst HDWalletProvider = require('@truffle/hdwallet-provider');\nconst path = require(\"path\");\nrequire('dotenv').config()\n\nmodule.exports = {\n  // See \u003chttp://truffleframework.com/docs/advanced/configuration\u003e\n  // to customize your Truffle configuration!\n  contracts_build_directory: path.join(__dirname, \"client/src/contracts\"),\n  networks: {\n    develop: {\n      port: 8545\n    },\n    testnet: {\n      provider: () =\u003e new HDWalletProvider(process.env.MNEMONIC, `https://data-seed-prebsc-1-s1.binance.org:8545`),\n      network_id: 97,\n      confirmations: 10,\n      timeoutBlocks: 200,\n      skipDryRun: true\n    },\n    bsc: {\n      provider: () =\u003e new HDWalletProvider(process.env.MNEMONIC, `https://bsc-dataseed1.binance.org`),\n      network_id: 56,\n      confirmations: 10,\n      timeoutBlocks: 200,\n      skipDryRun: true\n    },\n  }\n};\n```\n```\ntruffle deploy --network ropsten\n```\n## 5. Access your deployed contract\n```\ntruffle console --network testnet\n```\n## 6. Finally, invoke contract function and say hello!\n```\nHelloWorld.deployed().then(function(instance){return instance.sayHello()});Also, Read\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcamerodev%2Fhow_to_deploy_contract-basic","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcamerodev%2Fhow_to_deploy_contract-basic","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcamerodev%2Fhow_to_deploy_contract-basic/lists"}