2

I've developed a simple smart contracts with browser solidity:

pragma solidity ^0.4.9;

contract demo {
  string public name="Pietro";
  function changeName(string _newName){
       name=_newName;
   } 
}

And published on Ropsten Testnet.

After that I've created a simple interface using meteor and web3.js that correctly alert the public variable 'name' stored on the demo smart contracts. But this html interface is on my local computer.

So I want to publish that meteor project on my online website (linux server), and I want that all users can access (even if they don't have geth) to the public variable 'name'. Is this possible and how can I do this?

Thanks

user5688
  • 83
  • 6
  • When you say "even if they don't have geth", do you mean that they don't need an ethereum address to use your interface ? It's an important information you should add to your question. – Teleporting Goat Feb 02 '17 at 16:25

2 Answers2

2

One approach is to use a server such as nodejs and ensure it's got web3 and a blockchain connection. This is approximately what happens when using browser-only solutions like exchanges or etherscan.io.

The light client projects are aimed at providing that sort of user experience without the requirement of a full node.

Hope it helps.

Rob Hitchens
  • 55,151
  • 11
  • 89
  • 145
2

There are several possibilities.
1. Run your node with "white IP address" with parameter --rpcaddr. Read this - https://github.com/ethereum/go-ethereum/wiki/Command-Line-Options

geth --testnet --fast --cache=512 --ipcdisable --rpcapi eth,web3,net,personal --rpc --rpcaddr 82.115.184.12 --rpccorsdomain "*"

And use code like this:

var web3 = new Web3();
web3.setProvider(new web3.providers.HttpProvider('http://82.115.184.12:8545'));

But it isn`t safe - read this topic - How to reduce the chances of your Ethereum wallet getting hacked?

  1. Add you own server-side layer. See my question here - Does this architecture violate a Dapp-philosophy?
Artem
  • 687
  • 1
  • 5
  • 12