2

I am new to the development of DApps on ethereum blockchain. I want to make a contract Management System in which users can generate their own tokens and crowdsale using my web application. I am able to interact with an already deployed contract but I don't know

  1. how some one can deploy their crowdsale using my DApp.
  2. I have no idea about how to connect with the Metamask and users account using my application and finally
  3. how to deploy that web application on server and a domain.

Any help will be appreciated. Thanks

2 Answers 2

1

1) how someone can deploy their crowdsale using my DApp.

You can deploy the contract from WebUI using Web3.js or truffle.

I have no idea about how to connect with the Metamask and users account using my application

You can integrate metamask with your web application using the below code.

$(function () {  // equivalent to $(document).ready(...)
if (typeof(web3) === "undefined") {
error("Unable to find web3. " +
      "Please run MetaMask (or something else that injects web3).");
} else {
log("Found injected web3.");
web3 = new Web3(window.web3.currentProvider);
...
}   
});

3) how to deploy that web application on a server and a domain.

Use AWS services to host user website and Route 53 for mapping domain name with EC2 instance.

4
  • on the first step, i want to deploy a token contract but i want to give the variables like token name, symbol and decimal from a GUI (web interface) and want to deploy that contract from the same GUI by pressing a button to deploy. Any idea about this ? Jan 18, 2018 at 11:50
  • Yes, you can achieve this by using web3.js and new keyword in solidity contract. Jan 19, 2018 at 9:38
  • i am able to interact with a deployed contract using WebUI and web3.js but i am finding it difficult to deploy contract using WEB UI and web3.js. Kindly provide me some solid link for this. Jan 19, 2018 at 11:03
0

At first you need to write and compile token and crowdsale smart contracts. This will give you abi and bytecode.

Then you may deploy contracts from your DApp using Web3 API. This is done in two steps:

  1. Construct contract object like this: var myContract = new web3js.eth.Contract (abi). For this step you will need ABI of your smart contract packed into JSON as generated by Solidity compiler.
  2. Public deploy contract transaction like this: await myContract.deploy ({data: bytecode, arguments: [parameters]}).send ({from: account, gas: 1000000}). For this step you need contract bytecode as generated by Solidity compiler, constructor parameters (you may pass name, symbol, decimals, etc. here), and account to publish deploy transaction from.

How to use Metamask accounts from DApp is covered in Metamask FAQ. This will give you web3js object you may use. User accounts are available as web3js.eth.accounts. Note that user will probably need to explicitly allow your DApp to access his accounts.

About deployment, you may host your DApp on GitHub Pages as a quick start, and then buy a domain, e.g. on Google Domains or at any other domain registration service.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.