New answers tagged

0

me also happen but in different way. i created a new adding account in metamask but suddenly that new account have some small amount of 0.002eth. I checked in etherscan and found that it was transferred 4 month ago by somebody account. what going on i dont know.


0

Javascript doesn't have a 256-bit number type. The BN library represents them as objects in its own internal format. You get a 256-bit number from many Ethereum functions and those are always returned as BN. There is nothing freaky about it once you get used to it. Just cast everything as BN as you go, do your math with BN and use strings when you need ...


1

You can't read the data from another contract, but you can read it outside the blockchain. Having a private field means that only that contract can read the data on-chain. If you want to read the data off-chain you basically either have to analyze incoming transactions or consult your node client whether it provides some support for such functionality - ...


1

Your array is composed of Proposal but you are trying to push a 0 into a struct member. You can only push a Proposal on to an array of Proposal. Try this: pragma solidity 0.7.6; // SPDX-License-Identifier: UNLICENSED contract Vote { struct Proposal { uint votecount; } Proposal[] proposals; constructor(uint ...


1

The Proposal[] proposal declaration in your code is of a storage array. As such, you don't need to initialize it with proposal = new Proposal[](...);. You can simply push into it as many items as you'd like. The only thing actually missing there is an access-level (public/internal/private). As with regards to your push attempt, simply change this: proposal....


2

You can certainly code a full dapp with HTML & JavaScript only (and probably CSS or similar for styling), always depending on the project requirements. Once you import web3.js within your JavaScript code, you can use all methods from this library and interact with smart contracts. However, if you already know HTML, CSS and JavaScript, you’ll find a lot ...


Top 50 recent answers are included