Welcome to the discussion about this section. Here you can ask questions or post feedback about this specific section.
Hi I am not sure if it is good place to post, if not I am sorry. I have a problem with robsten testnet migration. After a migration my new created block is strange. It didn’t show any error during a migration. I mean there is no hash and contract address is to long. I can not check in robsten explorer if my migration was made in proper way because contract address doesn’t fit. Is it an error You mentioned on the course?
Almost looks like it was aborted. Then it looked like you typed something out manually on the command line? Could you screenshot your file structure from your editor or terminal and the second migrations file?
I have solved this problem. Actually it works:) when I cut in contract address , excess characters after 57, so my contract is 0x0a5849398b654714054187BEdfFF15E587d2ED57 and I can see in robsten explorer that everything is fine. My game is working on the testnet so It must be fine:) Great course by the way:) thanks
If one day I really have to put my project on github, how should I handle the mnemonic in the truffle-config.js ?
Have it in a separate file that only contains your mnemonic phrase and import that into your file. Then you exclude that file from github.
Another alternative is to set a variable in your environment variables and use that in your config.js.
Here is an example. https://hackernoon.com/how-to-use-environment-variables-keep-your-secret-keys-safe-secure-8b1a7877d69c
In case anyone else runs into this: When I went to MEW it was very different than the version Filip is using. There was no obvious way to display your secret key - like they have decided to protect us from ourselves.
If you go to the MEW home page there is a link at the top for classic mew - select that and then you can follow Filip’s steps.
Cheers,
David
MyEtherWallet has a new look (Graphic User Interface). It is different from lesson " Configuring Metamask & Creating Account", it only provides public address but not private key (unencrypted). Any suggestion how to proceed from here ?
Found it myself !
Proceed to ADDRESS, then SWITCH, then click the PRINTER icon, the private key is there.
Thanks for that… I ran into the same problem…
How do I fix this?
Thank you
add the flag --reset when you migrate. It will then replace your contracts.
Thank you Filip, its so super to be taking your class!
Great, thank you I’m happy to hear that you enjoyed it.
The classic version of myetherwallet is deprecated, and at the print icon there is no private key (as a fellow student suggested).
I think we have to make a throw away wallet in other way, maybe with metamask.
I only get zeros when trying to mint with metamask, this was working fine when on my local network.
Also, when I try to console.log the total supply, I get “undefined”, this was also printing the right amount on my local network. Any ideas?
EDIT - SOLVED
For some reason I had the wrong contract address.
I’m wondering, how do you secure your game? People can hack the js variable for the coins, and then mint 1.000.000 tokens for themselves, how can this be prevented if we want the custom token to have some kind of real value? Thanks.
Any ideas?
@gabba
Hello @pmk
With this kind of game you can’t right now that’s why there is no “live game” on ethereum but maybe in the future with eth 2.0. Right now transaction are too slow. Most games are just clicking game because you need to wait for block confirmation.
If you really want to secure your game you need to generate a map when you start the smart contract with the position of the coin, and you need a way to track the user movement.
Let’s do a basic example (not 100% secure)
You will have to generate a map with coins at x/y position on chain when the contract will be initialized
ex: coin 1 at 12/7 and coin 2 at 20/7
your player pop at 1/7 you know that to go from 1/7 to 12/7 it takes 2sc for the player (if it doesn’t cheat)
You have the variable set in your smart contract 12/7 2sc and 20/7 3.2sc.
When the user want to start he clicks on a start button (it will generate the smart contract random variables), when the transaction is mined you have the timestamp of a block as a reference, and it ll trigger an event listener on your frontend so the player can start playing.
The coins positions are received by the front and set on the map.
Now you run with your player to catch the first coin, when there is a collision you need to validate it on chain. (is it possible that with his current speed that he can catch the coin ?) you will have to wait for a block confirmation, then you go to the next coin.
Ideally each time the player is pressing a key you will have to validate it on chain.
Just take the example of video games right now and 20 years ago, now all games are played online because every actions are check on the backend by the server, before you could easily reverse them by modifying the hexadecimal value of the stack at the runtime.
I think this space is growing fast so you can create your game and wait to find a blockchain fast enough to validate your actions on chain, like a real backend.
PS: I just make this example on the fly, so of course it’s will not be a mechanic 100% secure but i hope you get the idea
So I would have to check for every game coin on the blockchain, and a smart contract that mints maximum 1 token per call… wow I see, so not feasible at the moment, makes me a bit sad, let’s see what eth 2.0 brings. Thanks a lot for your lenghty response.