New answers tagged

2

I fixed it. Add this code in app.js: // MetaMask injects its own web3 instance in all pages, override it // as it might be not compatible with the one used here if (window.web3) window.web3 = web3;


0

I am using Etherscan Api https://api.etherscan.io/api?module=stats&action=ethprice&apikey=YourApiKeyToken {"status":"1","message":"OK","result":{"ethbtc":"0.01861","ethbtc_timestamp":"1566457540","ethusd":"185.73","ethusd_timestamp":"1566457537"}}


0

I had the same problem when migrating on private ethereum using geth. The problem was solved as soon as I started the mining process. Make sure that your blocks are getting mined.


0

I'm not sure what you mean with tolerance but here's how it approximately works on Ethereum: A block has a timestamp A miner assign a timestamp to a block but the timestamp may not be before the previous block's timestamp and not too much in the future So, yes, the timestamps have to be increasing block by block but the miners have some influence on what ...


2

Get the contract object via: const contract = await new web3.eth.Contract(JSON.parse(interface), smartContractAddress);


1

The team at Blocknative wrote an excellent post detailing Canceled Transactions that answers your question: https://blog.blocknative.com/blog/canceled-transactions Here is what they say about Canceled TX: What are Canceled transactions? On Ethereum, a Cancel transaction is an attempt to overwrite a currently pending transaction with a new transaction. ...


1

The constructor doesn't take a name. Change your code to: constructor (ChampTokenSale _tokenContract, uint256 _tokenPrice) public { admin = msg.sender; tokenContract = _tokenContract; tokenPrice = _tokenPrice; } (See "Creating Contracts" in the docs.)


0

You need to execute ethereum.enable() first, see: https://metamask.github.io/metamask-docs/Advanced_Concepts/Provider_API Alternatively you could disable the privacy mode of metamask (in settings / Security & Privacy) See https://medium.com/metamask/introducing-privacy-mode-42549d4870fa


0

As per your code, the owner of your contract is the Account Address with which you deploy the contract on the network: constructor() public { owner = msg.sender; ////For eg. 0xca35b7d915458ef540ade6068dfe2f44e8fa733c -> JS VM } Now since the transferOwnership() function call uses the modifier "onlyOwner", it mandates msg.sender for this transaction ...


0

The notion that the future block hash can't be guessed overlooks the possibility that the attacker can be a purpose-built smart contract that will call the victim contract. The attacker doesn't need to know the "future" block hash, or anything else that might be a variable, because it can know the present block hash. Consider this little example I created ...


0

Why A transaction may succeed or fail depending on when/where it was mined. The initial state matters and that is only knowable when the transaction exists in unambiguous transaction order. Consider getting paid on the same day rent is due and your landlord has a post-dated check. The order of events, the transaction order, may be the determining factor (...


0

failed tx's get into the block because they consumed your gas anyway, the gas is translated to ETH with the term multiplication gasUsed * gasPrice = ETH


0

You can try implementing smth similar to OpenLeppelin Roles library. In roles directory you can find usage of this library.


0

Its not going to be possible to upgrade the contract, but copying the values should be trivial. The node creating new contract should read the current state via contract accessors (if those exist), otherwise, scan the chain for contract calls to this contract and set value based on the inputs from that.


0

Clique needs the initial list of signers in the extra-data section. Please use puppeth to generate a valid Clique genesis block. You don't need to manage your network with Puppeth afterwards, you can also just create the genesis and dump it out.


1

Do we need to sign the transaction by web3.eth.signTransaction after initiating transaction via web3.eth.sendTransaction? To me, the fact that you've used the word after implies that you are totally baffled here... unless you actually meant before... In either case, here is the deal: You may use web3.eth.sendTransaction({from: account, ...}) only if you ...


1

I'd assume you are using web3 v1.2. signTransaction will sign a transaction but it will not send it, returning an hexadecimal string with the signed transaction instead. You can use sendSignedTransaction to send it to the network. sendTransaction will sign and send the transaction to the network.


2

As you said, more computation is required if the block size is bigger. But mining nodes (initially) do the actual computations - they include transactions in a block and execute the transactions. So if there are more (or more complex) transactions more computation is required from the mining nodes. Other non-mining nodes do various levels of validations (and ...


1

The difference is a developer or owner can arbitrarily change the code or the state (database) of a centralized system using centralized software. Use a smart contract in the case that you want to data itself to rise to the level of an inarguable fact. That is, new data enters the system only through channels defined in the smart contract. Inversely, the ...


0

I think crypitor is what you need, they support internal transaction on ethereum as well. you can monitor the total in and out of an address in a transaction. No need to scan every address anymore. Also i saw them support ERC20 transaction. It increases performance for your application. You just need to build a webhook api to listening their push data (...


0

Checking the link provided in the previous answer or here, you can get to know that your transaction was put into a block numbered 8244682. Drilling deeper, this block was created by a miner node who gave her address as 0x5a0b54d5dc17e0aadc383d2db43b0a0d3e029c4c first. She then broadcasts it to her peers. Technically all the nodes who have received this ...


0

You can only have one validator i.e. the miner that added the block . If you are talking about confirmation, a block is confirmed after the 5th block is added to the chain i.e your block + 5 more blocks. If you take the average blocktime of 15seconds, your block (15s ) + 5 more blocks (5 * 15 = 75) - 90 seconds. Here is your transaction on aleth.io https:/...


0

No, Ethereum does not support any data encryption schemes directly. You have encrypt data off-chain and then send it to the blockchain in encrypted format. You can't have any encryption keys or similar in the blockchain as everything is public. You can use whatever encryption you want as it's not related to Ethereum/blockchain at all.


0

ERC721 is similar to ERC20 in the approve/transferFrom. It has to be the user whom approves your market contract, the market contract cannot request for approval. For example to approve the market the user will execute token721.approve(marketAddress, id, { from: userAddress }) Now the market can transfer user tokens to the recipient (or you can use ...


1

Let's make some things clear first: block confirmations are not required by the blockchain, there is no static amount of confirmations to make something secure and a transaction is valid after it has been mined in a block. Now a bit more explanations. Miner nodes include certain amount of transactions in a block which they try to mine. Whoever succeeds in ...


1

Ideally huge data like images should not be stored on the blockchain. You can store a pointer to the location of the file off-chain as well as the hash of the file on chain. Then while reading the file, you can use the hash from on chain to verify whether the data was changed after it was inserted.


0

Merkle Tree is a tree which uses Hash pointers. In Bitcoin's blockchain, Every new block contains a section where it stores the a Hash Pointer which is related to the previous block The Hash pointer has two things encapsulated in it The location of the previous block The Hash of the data in the previous block If someone tries to change the data in the ...


0

I would say it depends on how your users interact with the contract. If they are using their own assets (Ether/tokens) - as is the case typically with dApps - then one might claim that they should know what is happening. But if users use centralized wallet's assets and they don't really even realize they are using a dApp then they don't need to know. But ...


Top 50 recent answers are included