New answers tagged

0

Here's what works for me with MetaMask Version 7.1.1: Signing a message: var message = "Some string" var hash = web3.sha3(message) var account = web3.eth.accounts[0] web3.personal.sign(hash, account, function(error, signature) { console.log(signature, error) }) Getting the address of the signature: var signature = "0x..." var message_hash = web3....


1

Nodes in blockchain do not understand what smart contract is. Rather smart contract is a piece of code that can be written in Solidity or Serpent(any language which supports generating bytecode understand by EVM (Ethereum Virtual Machine)) You have to write a smart contract which can have some functions maintaining its own state variables. These smart ...


0

I'm confused with the structure of DApps using Ethereum smart contracts. Each contract has a unique address, the bytecode (which is the EVM's implementation of an executable), and state storage which is (very) roughly like a database. The state can include information, like balances, for the users. The bytecode implements the contract's rule, such as the ...


1

Once the contract is deployed and has a specific address (lets say address No.1) then the user interact with the functions of that smart contract in that specific address - address No.1. If the user deploys his own version of the smart contract or dapp then this smart contract has a new address (address No.2). If there is a function in smart contract No.1 ...


0

ethereum.enable() did the trick for me. My solution: 1. Added: window.addEventListener('load', async () => { try { await ethereum.enable(); } catch (error) {} }); Updated the gas value: ApprovalContract.methods.deposit(toAddress).send({"from": fromAddress, gas: 1000000, "value": web3.utils.toWei(amount,'ether')} Changed Metamask ...


0

Try this, Open a new terminal and move to the folder chapter1 (following the tutorial). In the terminal run this node_modules/.bin/ganache-cli Open a new one terminal and test node, following the 2nd section of the tutorial. Don't close the terminal opened in the 1st step. That works for me!


0

https://gist.github.com/Godtide/1a84c98d1dc7ec434672bed17f3dd09c For more clarification. /* * NB: since truffle-hdwallet-provider 0.0.5 you must wrap HDWallet providers in a * function when declaring them. Failure to do so will cause commands to hang. ex: * ``` * mainnet: { * provider: function() { * return new HDWalletProvider(mnemonic, '...


0

This is a fairly straightforward use case. You can hold the Ethers or Tokens in a smart contract account. Add a spending function that can be called only by authorized employees and a revoke function that can sent the balance remaining to the owner.


0

The funny thing about "banning" a decentralized concept is that you can't really ban it. You can make it difficult to run a node (block its connections to outside world) but it will never be impossible. And there is no way to stop cryptocurrencies from being transferred into accounts owned by Indians. And there will always be ways to transfer them onwards ...


0

I implemented this and it works great. I am using Python/Flask in the backend so you would have to find equivalent backend code for Node: Backend: store the user by their public address in the database along with a nonce used for signin The most simple schema for a User/Account is: public_address = db.Column(db.String(80), primary_key=True, nullable=False,...


-1

The following code works as you need: pragma solidity 0.5.0; contract UserManager { struct User { string username; string password; address userid; bool isAdmin; } mapping (uint => User) users; uint totalUsers=0; function checkIfUserExists(address userid) public view returns(bool) { for (uint o = 0; o < ...


0

I think the first question should be 'Why we must use blockchain?', you will understand why. If you use normal database center like what we mostly use on the internet everyday for electric voting, then a center server can control your vote so in theory, they can modify it, delete it, ... And in defcon25 they show that it is VERY EASY to hack into a voting ...


0

If you're outside the dapp/crowdsale company and allocate tokens to the creator I don't see why this would negatively impact the integrity of the company. If you're inside the dapp/crowdsale company and allocate tokens to yourself/your company as the creator I also don't see why this would hurt the integrity as long as you are transparent about how the ...


0

Minds isn't even decentralized so it would work like a normal private company selling shares. If it was actually based on ethereum then the investors would probably gain token. A social media network with no users isn't worth anything and so the original one will have all the users and capital Yes anyone could fork Minds but that doesn't mean they'll earn ...


0

Smart contracts have to be written in a language which can be compiled into the right type of bytecode. So in theory any language will do but in reality Solidity is almost the only option - there are a few other small niche languages (Serpent, LLL) but with not much usage. On top of the smart contract is some client which interacts with the blockchain - ...


0

There are at least two sides two this: 1) The contracts may have some access restrictions so that only certain addresses can perform certain administrative tasks. So you may not be able to use the same smart contract. If the smart contract is also open source then you can duplicate it and use that. 2) Many products in the market are not so much about the ...


Top 50 recent answers are included