14

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?

5 Answers 5

4

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.

2
  • 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? Dec 16, 2017 at 20:13
  • 1
    I think this is best answer now. Because I have included many libraries that I cannot simply migrate to Remix.
    – hqt
    May 29, 2018 at 17:48
13
  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.

2
  • 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? Dec 16, 2017 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, 2017 at 20:42
1

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

3
  • 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? Dec 16, 2017 at 20:11
  • 1
    u mean have your local synced node? since u can do it with a public synced node... Sep 26, 2018 at 11:46
  • 1
    You can just deploy to a existing running public node... no need for infura
    – redigaffi
    Sep 18, 2021 at 13:19
1

[2023 update]

Two things:

(a) you don't need to run your own node

(b) you don't need to use Remix's default node provider either (this is the top "Environment" section when you go to deploy).

Instead of Remix's default node provider, you can use any node provider of your choice with your own private API key. You do this by choosing "Injected Provider" as your environment. Developers often chose a different node provider because they want to build more scalable, reliable production-grade dapps.

--

Here's the Remix steps to deploy with a node provider of your choice:

  1. Add and compile the contract code in Remix

  2. Add your chosen RPC provider (Alchemy, etc) as a network in Metamask. You do this by clicking on "Add a network" in Metamask. I usually call this new network: "[Network name] via Alchemy". Get the URL by logging into Alchemy and grabbing the HTTP API key.

  3. If it's a Ethereum testnet, get testETH from faucets to add to your Metamask. Here are Alchemy's free faucets: Sepolia or Goerli

  4. Connect Metamask to Remix. If you're having issues, remove another connected wallet first before connecting Metamask

  5. Deploy your contract by choosing the "Injected Provider" as the deployment environment. This injected provider comes from your selected provider in Metamask. Make sure the right Alchemy network that you want to use is selected in Metamask

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 and acknowledge you have read our privacy policy.

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