Hot answers tagged

3

You should avoid iterating the list of permitted accounts. It's an expensive approach that doesn't scale and it has a lot of moving parts. Consider instead using a mapping. This is a namespace where all the uninitialized indexes return false, 0, empty, depending on type. For example: mapping(address => bool) public whitelist; returns true or false for ...


2

All your migrations run from the beginning. Using ganache blockchain (for this example), you can check this information at the bottom of your contract's .json files. Before --reset: "networks": { "5777": { "events": {}, "links": {}, "address": "0x2429A2d4d4eE68C33a08e0490f5E3daf9d3329Ef", "transactionHash": "...


2

I recommend that you look at the OpenZeppelin guide on Access Control, specifically the section on Role-Based Access Control as using Roles from OpenZeppelin appear to meet your needs. https://docs.openzeppelin.org/v2.3.0/access-control For questions on use, you can also ask in the community forum https://forum.zeppelin.solutions/


2

You are making a fundamental mistake which makes it all seem much harder than it really is. Instead of an array, your should use a mapping(address => bool), let's call it whitelisted. Add people in the whitelist like this: whitelisted[_address] = true; then in your modifier, you can simply do this: require(whitelisted[_address]);


2

I assume that you are connecting your DApp with the blockchain using the browser web3 instance, which is provided by metamask. The alternative is to use Infure or your own node and change the web3 provider, then metamask will not pop-up and you can implement your own logic when someone click on a button to send a transaction, but then it is more complicated.


1

Your question is too broad, because Ethereum is a smart contract platform and payments can be handled by contracts. If you just want to learn ethereum development I would advice to checkout cryptozombies to get started into coding in a fun way. Cheers


1

Both players should keep their own copy of the latest state. The server could be a backup, and although it would be a centralized back up, the server will not be able to tamper with the state if players control their secret private keys. https://medium.com/@graycoding/lessons-learned-from-making-a-chess-game-for-ethereum-6917c01178b6 and its code may also ...


1

Please check https://web3js.readthedocs.io/en/1.0/web3-eth-contract.html#id10 . You have to add .methods to your contract instance and then call the smart contract method.


1

Metamask is a browser extension. More info: https://metamask.io It is not used in node.js or server side implementation. For server side, you have to unlock accounts using private keys, etc. For the browser side, it injects web3 object, which you can use in browser side Javascript and call all the methods and all. Sample code for browser side ...


1

To add to Greg's answer, this documentation provides background on what Truffle artifact's are: https://trufflesuite.github.io/artifact-updates/background.html#what-are-artifacts


Only top voted, non community-wiki answers of a minimum length are eligible