Ethereum coinflip dapp discussion


In part 4 of the coinflip dapp web3 was changed to web3_instance because the injected web3 would be overridden . I didn’t quite understand this explanation - what is overriding what? Can anyone elaborate on this?


Hi, I have a question that in the flip.sendTransaction(,function(error,result)){}

  function flip(){
  let val = parseInt($("#bet").val());
  instance.flip.sendTransaction({from: "ADDRESS", gas:100000, val}, function(error, result){

what is the result argument that gets called back?


The code seems like its becoming like callback hell, any assistance?


As I’ve understood it, the superblocks software does some magic with re-writing the window.web3 variable. This did not really work when using the injected web3 from MetaMask. I’m not sure how this works in great detail, but this is what I heard from talking to the superblocks CEO.


Result is the response from the smart contract function. In this case it’s the transaction hash. That tx hash will later on be used in another JS function when we wait for the tx receipt.


Let me know if you have any specific questions. I would love to help you out. I understand that it might be difficult to grasp.


Hy everyone,
I have some troubles with running the code locally in private network using Ganache.
Why my .js code doesn’t want to work in the View tab? Is it because of not using the recommneded test network Rinkeby? The Submit button simply wouldn’t work and the balance isn’t showing up no matter what…

functions getResult and getBalance seem to be not working…
And one consequent question is how then we can debugg in Superblocks? is there any console window?

My code is pretty much the same as on the github.


Another question…
When the smart contract is deployed from remix in the Javascript VM environment, the setter functions are able to give a return value or an output i.e., the “decoded output” part is not empty.
However, when using other environments like web3 provider / injected web3 , why can’t setter functions return any value?
I don’t understand this inconsistency across environments. Could you please explain this?



I’m using Ropsten Test Net and balance doesn’t get updated. Also I’m not getting header 3 text e.g. “You won!” or “You lost!” either. I’ve tried with source code from Github same result.


Hi @Zatox11 @Zack22 and @NoRush

Does the line below in your app.js (flip function) look like this? If yes then change result to txHash.

  instance.flip.sendTransaction({from: "0xa48f2e0be8ab5a04a5eb1f86ead1923f03a207fd", gas:100000, val}, function(error, result){

Change to:

  instance.flip.sendTransaction({from: "0xa48f2e0be8ab5a04a5eb1f86ead1923f03a207fd", gas:100000, val}, function(error, txHash){


@Zaid @bulletproof @Navi check if the solution I provided for Zack22 solves your problem.


I have not tried it with Ganache. Maybe one idea is to post an issue on their github. I know the superblocks people well, they will be happy to hear from you.

When it comes to debugging. The normal web console works fine for me. I get all of the output from Superblocks in my chrome console.


Hi Zaid,

Different implementations of the EVM works differently. They sometimes support different actions. This is a consequence of having an open source, decentralized network.


Have you tried to debug it? For example print something to the console or use alert to see if you get a response at all from the network.


Hey Filip,

I was wondering if you were aware that your github Coinflip Dapp files need to be corrected. For example, in html files, there are still “Hello World” strings.


Thank you! I have updated them now. Let me know if you find more errors.



I can’t get to DApp work. First, I followed the videos; it didn’t work. Then I copy paste the codes from github; it still doesn’t work. There are little issues. When I copy paste the last one I don’t get the balance and also can’t use the submit button. For example,


I can only add one screen shot. If you can update those, it would be great.

I need a DApp working to be able to compare with a regular App and talk about the differences. Thanks:)


These 2 errors in github JS code are likely causing people their issues

function flip(){
let val = parseInt($("#bet").val());
instance.flip.sendTransaction({from: accounts[0]], gas:100000, val}, function(error, txHash){
fix to accounts[0], ^^^^^^^

function waitForReceipt(txHash, cb){
web3_instance.eth.getTransactionReceipt(txHash, function(err, receipt){
^^^^ fix to (error)


Hello Everyone,

I have been waiting to receive ether for Rinkeby Test Net for 4 days. Can anyone send me some? Thanks



Does anyone know why I still don’t receive any ETH for the Ropsten Test net