6

So my Mix-ide install seems irrevocably crashed and given that there's no other IDE with integrated UI, I'm forced to face the inevitable learning of authoring HTML UI without much of a web dev background. Though there's plenty of material out there about backend DAPP development, I find almost nil regarding front end DAPP UI development. I'd like to start learning how to integrate with Mist. But that aside....

I have the web3.js package in Node and I have web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545")); in my UI html.

Q. For the purposes of a local test chain, where am I suppose to store this page and what serves it to what URL?

3

So for serverless connection of an HTML front-end to a local node, I:

1) dropped web3.js into the DAPP's directory

2) in the HTML included:

<script type="text/javascript" src="web3.js"></script>
<script type='text/javascript'>
var Web3 = require('web3');

if (typeof web3 !== 'undefined') {
  web3 = new Web3(web3.currentProvider);
} else {
  // set the provider you want from Web3.providers
  web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545"));
}

3) started geth with the --rpccorsdomain="*" switch to prevent Chrome from blocking the calls.

  • Where should be DAPP's directory? is it where html exist? @o0ragman0o – alper Mar 1 '17 at 11:30
  • 1
    Same directory as your existing dependant HTML is easiest. I was doing this just to get light-weight test harness front ends.I'm mostly using Meteor now which has some recommended directory structures. – o0ragman0o Mar 2 '17 at 12:20
2

given that there's no other IDE with integrated UI

browser-solidity?

How about truffle for a web framework with contract compilation?

Extratip: testrpc to simulate a blockchain the lean way.

  • Have been using browser-solidity but don't know if it's possible to integrate/connect a UI as Mix did. Trying to avoid truffle for now as it constitutes another learning curve while I'm just trying to get the basics of hooking in a UI to a node. dropping web3.js in the same directory and 'src'ing it in the web page works, but now am faced with CORS problems... – o0ragman0o Sep 1 '16 at 10:56
  • I understood "integrated UI" more that it provides a form for calling functions – Roland Kofler Sep 1 '16 at 11:00
  • Talking more front end HTML. Mix-ide has webkit (or whatever) so you can edit and hook into your contract from the web page. Just looking for quick and dirty ways to do this with a geth on a private test chain without having to set up a local web server. – o0ragman0o Sep 1 '16 at 11:09
  • got it... now I know what --rpccorsdomain='*' is actually for! – o0ragman0o Sep 1 '16 at 11:17
  • yeah and Metamask should also do what Mix does although not integrated – Roland Kofler Sep 1 '16 at 11:25

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.