2

The callback is returning the transaction hash. Instead, I suggest you to use "promise" or ".on" to get the receipt as documented in the package document https://web3js.readthedocs.io/en/1.0/web3-eth.html#sendsignedtransaction It would look like something like: // Broadcast the transaction web3.eth.sendSignedTransaction(raw) .on('receipt', console.log); ...


2

If you are using web3, you could easily sign any transactions or just messages: https://web3js.readthedocs.io/en/1.0/web3-eth-accounts.html#sign If you don't want to use web3 (for example because you dont want to initialize with an ethereum endpoint), you can find some alternatives: https://docs.ethers.io/ethers.js/html/api-wallet.html https://github.com/...


2

Web3.js returns all uint types as BigNumber objects. If you want to get the decimal string which represents the numeric value embedded in a BigNumber object, then you can call function toFixed on that object. For example: const [reward, length, votersCount, manager, pollActive] = await myContract.methods.getSummary(); console.log('reward:', reward....


1

If I understand correctly your want to upload a file from the client machine to the web application using the standard HTML tag <input type="file"> and then hash the content of the file. Your code is actually hashing the full path of the file. If you want to read the content of a file, I recommend to use FileReader like this: HTML: <div> &...


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

You may want to consider the following alternative for deploying a contract (tested with web3 v1.0.0-beta.34): async function deploy(contractName, contractArgs) { const abi = fs.readFileSync(YOUR_ARTIFACTS_PATH + contractName + ".abi"); const bin = fs.readFileSync(YOUR_ARTIFACTS_PATH + contractName + ".bin"); const contract = new web3.eth....


1

Web3js is an official project of the Ethereum Foundation. Ethjs is a lightweight reimplementation of web3.js that has an async only API. There is no dependency relationship between them. Another library that is widely used is ethers.js


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