12

I'm new to solidity and smart contract programming. I have already made and deploy smart contracts successfully, but always using Mist.

Now I'm not able to do so, because I can't complete a node update with the full blockchain, and now I feel that I will never end. So I'm looking for alternatives.

So, my question is, probably very basic, but is there a way to deploy a contract without running a full node?

11
  1. Install https://metamask.io/ and
  2. Navigate to https://remix.ethereum.org/
  3. Click on settings -> choose your compiler (e.g. 0.4.19+commit.c4cbbb05). Note that optimization is unchecked.
  4. Login to metmask and choose your network (i would suggest first testing using ropsten test network and using the buy button to get ETH from a free faucet)
  5. Go back to the compile tab
  6. Delete the contents of the example contract
  7. Paste in your contract (it should auto compile)
  8. Click on the run tab
  9. Click on the deploy button
  10. Metamask will open, choose your gas price and click Submit to sign your transaction
  11. Open metmask again, click on the transaction hash, which should redirect you to something like https://ropsten.etherscan.io/tx/0xabc123....
  12. Once published. Click on the contract address which should be a url like https://ropsten.etherscan.io/address/0x987cba...
  13. Click on Contract Code tab on etherscan, click Verify and Publish
  14. Set the name of the contract to the exact name as in remix, Compiler to the same exact version as in remix and set optimization to "No" if you didn't click it on remix in step 3.

You should now have a published contract, with source code on etherscan.

  • Sounds great, only one more question: I usually repoen my deployed contract in Mist to run additional functions like setting a value into a variable in that contract. How can I do this with your method? – Moisés Briseño Estrello Dec 16 '17 at 20:10
  • 1
    When you click create and it is mined, you will see an interface to the contract, its not great, but it works. You have to input as a sort of json like value, i.e. put quotes around large numbers, hashes and strings. @MoisésBriseñoEstrello – Victory Dec 16 '17 at 20:42
3

I regularly use truffle and infura.io to deploy contracts in a programatic and reproducible way.

Infura provides a public web3 service, you have register to their service they provide an ACCESS_TOKEN you have to use, for example https://mainnet.infura.io/ACCESS_TOKEN.

This is not a full geth node, some things are not supported yet.

I follow this guide to configure truffle to use the infura endpoint provided Using Infura (or a custom provider).

Another possibility is to rent a node in QuickNode or similar service.

  • I feel that this is the best answer now. Infura sounds like the solution, but what if I don't want to use truffle? Is there a simpler method just to paste my already written code in a simpler tool? – Moisés Briseño Estrello Dec 16 '17 at 20:13
  • I think this is best answer now. Because I have included many libraries that I cannot simply migrate to Remix. – hqt May 29 '18 at 17:48
0

Presumably, there is no way you can do it without having a full node in sync.

It is quite a common issue for many people that Mist fail to load main net fully. Perhaps, you can try to sync with geth from command line, and afterwards deploy contract using node.js, as in this example

  • I always sync it with geth, but it is always 12,000 blocks from finishing. New ethereum blocks appear more rapidly than my geth syncing. You know how to optimize it? – Moisés Briseño Estrello Dec 16 '17 at 20:11
  • u mean have your local synced node? since u can do it with a public synced node... – Ilan Dshare Sep 26 '18 at 11:46
0

You could compile the contract and create and sign a transaction for deployment. Like it's done here. Afterwards you can push that transaction to a block-explorer like Ethernode:Pushtx

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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