Hot answers tagged

2

check this question - https://stackoverflow.com/questions/5786851/define-global-variable-in-a-javascript-function If web3 is not defined as a global variable, but you have "web3 = new Web3(web3.currentProvider)" inside a function - the web3 object will be local for that function only, while with window.web3 it will be globaly accessible


1

There is no dist folder (containing the web3.min.js file) in the latest versions (1.x) You can select tag 0.20.7 on github before downloading the zip - it contains a ready to use web3.min.js


1

First you need to write and deploy a simple storage smart-contract (with solidity and truffle), then you need to use the web3js library to connect to the blockchain and later to call your function in the smart-contract --> send a transaction to upload the hash of the file in your deployed smart contract The web3 library provide a function to calcuate the ...


1

I hope this will work for you, const contract = new web3.eth.Contract(abi); const estimateGas = await contract.deploy({ data: bytecode }).estimateGas(); contract.deploy({ data: bytecode, arguments: ['TestToken', 'Token', 18, '1000000000000000000000'] }) .send({ from: yourAddress, gas: estimateGas, }) .on('error', (error) => { console.log(...


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