5

This is happening because ethereumjs-tx library has changed its syntax. This is the working version of your code: const EthereumTx = require('ethereumjs-tx').Transaction var Web3 = require('web3') var web3 = new Web3('http://127.0.0.1:7545') //Setting Receiving and Sending Address var sendingAddress = 'ADD SENDING ADDRESS HERE' var receivingAddress = '...


4

There's a package that contains suitable functions, here -> pubkey/eth-crypto See: publicKey.compress(), and publicKey.decompress() The compress code is below. (Copy + pasted from this file.) var _secp256k = require('secp256k1'); function compress(startsWith04) { // add trailing 04 if not done before var testBuffer = Buffer.from(startsWith04, '...


4

UI Tools cleanunicorn.github.io/santoku etid.wtd.ru ethtx.info moesif.com/solidity-abi-hex-decoder/decode Note for these you will need the ABI of the contract. Node Packages @ethersproject/abi (part of the umbrella package ethers) abi-decoder ethereum-input-data-decoder Recommendation Use @ethersproject/abi, it's the safest approach of all. Ethers is ...


2

What I can say from my experience, is that none of the above replies worked out of the box for me. This is how I have implemented it (tested with MetaMask and WalletConnect) Frontend web App (ReactApp) Challenge is to sign a nonce (random string) provided by server. This is how a safe sign can be required let sign = await web3.eth.personal.sign(nonce, ...


2

Aug 2021 I achieve this by installing the npm package called eth-sig-util. Here is my code: const ethSigUtil = require("eth-sig-util"); function checkSignature(nonce, signature) { const msgParams = { data: nonce, sig: signature }; return ethSigUtil.recoverPersonalSignature(msgParams); }


2

ethereum-utils checks string fields if they are hex. When you send data field as empty, then it throws the error. You can send data as '0x' like they said above.


2

To answer the title directly, the chain_id of ganache is 0x539 (or 1337).


2

Every transaction in a block is processed at the exact same time. If you have the transaction information (which is the data you posted), you can use the blockNumber to look up the block information with getBlock() and find the timestamp of the block (which is also the timestamp of the transaction). In your case, you would simply call: web3.eth.getBlock(...


2

A small correction: ERC20 is not a standard for smart contracts: it's a standard for creating tokens and most tokens around Ethereum are based on that standard. An ERC20 token is a smart contract which simply has an internal ledger which says which address owns how many tokens. So whenever someone transfers those tokens around, one balance is decreased and ...


2

This part was wrong. tx.sign(privateKey1) Fix it like this: tx.sign(privateKey1Buffer)


2

I've notived at least 2 different ways of doing it. Binance will send and keep a small Eth balance in the deposit address. They will use that Eth to send the tokens from the deposit wallet to the exchange hot wallet. Kraken uses contracts as deposits accounts instead of EOA. There is no Eth balance in those deposit contracts. Edit: The hot wallet calls a ...


2

This is the ABI encoding format used by Solidity, which is documented in the Contract ABI Specification. Basically, static values (e.g., numbers, booleans, bytes1..32) are encoded into 32 bytes (64 hexadecimal characters), and dynamic values are encoded at the end, where a pointer to the location is encoded in place instead. Using your result as an example, ...


2

This looks like a notation in math: https://en.wikipedia.org/wiki/Q_(number_format) For example, the specification Q3.12 describes a signed binary fixed-point number with a w = 16 bits in total, comprising the sign bit, three bits for the integer part, and 12 bits that are assumed to be fraction. That is, a 16-bit signed (two's complement) integer, that is ...


1

I had this error because I hadn't removed 0x from the prefix of the private key.


1

According to metamask docs: eth_requestAccounts Returns string[] - An array of a single, hexadecimal Ethereum address string. Description Requests that the user provides an Ethereum address to be identified by. Returns a Promise that resolves to an array of a single Ethereum address string. If the user denies the request, the Promise will reject with a 4001 ...


1

Short answer: you need the ABI in order to call the contract. Let's talk a bit about how to get it, and then talk about one way you'll still be able to interact with the contract if you don't have it (by writing your own for the part of the contract you need to interact with). 1) Etherscan Etherscan has something called verified contracts. You can check if ...


1

All functions interacting with the network return promises. You must wrap everything in an async function and await them. E.g. var Tx = require('ethereumjs-tx'); var Web3 = require('web3'); const {ethers} = require('ethers'); (async () => { ... // get transaction count, later will used as nonce var count = await web3.eth.getTransactionCount(...


1

Depends. What i get from reading your question is that the tokens are supposed to go from the user wallet to its address in your exchange ( generated by your website) and then to your company wallet. If the wallet generated by your website is a smart contract that automatically forwards the transfer to your company wallet then the user will pay for gas. If ...


1

This error comes from a bad formatting of your transaction. In fact, it must be encoded in rlp format (serialize() function) before being sent to the node. In addition, you should change gas to gasLimit and add a gasPrice property in the rawTx object. Here is a working piece of code, taking these changes into account : const Web3 = require('web3') const Tx =...


1

You need to provide your private key your hardhat.config.js file instead of your public key/address. module.exports = { solidity: "0.8.4", paths: { artifacts: './client/src/artifacts' }, networks: { hardhat: { chainId: 1337 }, ropsten: { url: "https://ropsten.infura.io/v3/938ec750ced64edda8fc17c9e135d0f6&...


1

After a lot of research, I went with ethereumjs-util, bip39 and hdkey. A Installations Install Node.js (npm will also be needed but it is included in node.js) Then open a CMD and install the packages : You can do it in 2 ways: Method A: install via the install @ethereumjs/tx command. This will install the package in C:\Users\<iuser>\node_modules\ and ...


1

The first problem many encounter when dealing with Ethereum is the concept of numbers. Most common currencies are broken down with very little granularity. For example, there are only 100 cents in a single dollar. However, there are 1018 wei in a single ether. JavaScript uses IEEE 754 double-precision binary floating point numbers to represent numeric values....


1

I gave up trying to ethereumjs-tx in the end as I came across this: https://stackoverflow.com/questions/64526925/how-to-swap-tokens-on-uniswap-using-web3-js Managed to get that solution up and running it solved that particular error I was getting.


1

The error was because of a typo mistake. I was passing an undefined argument which caused this error. Its not an error because of no. of arguments.


1

Ganache is as server node to ethereum chain and you can using standart ethereum rpc api (attention, look port , default,7545 , but bettet to check, see here more details about configuration ganache https://www.trufflesuite.com/docs/ganache/reference/workspace-default-configuration) For calling method to only getting data from smart you should using https://...


1

Yes, you can generate one Wallet contract per every EOA of your user, and this contract may act on behalf of the user, being the user who controls it with its signature. To see an example, check Augur's Wallet contracts here: https://github.com/AugurProject/augur/blob/0a12a20a3ab0f4a822ec2c5070136e3e4a8180c4/packages/augur-core/src/contracts/...


1

Try this: web3.eth.getBalance('0xF33b5a2B692bE695d6FD6f3136eB8919f2666e3a').then( function (weiBalance) { let ethBalance = web3.utils.fromWei(weiBalance, 'ether'); console.log(ethBalance); } );


1

Seems like its a bug. I tried to raise the issue to the maintainer repo. You can follow rest of the discussion here.


1

Here is a working code with web3js 1.3.0, ethereumjs-utils 5.2.5 and solidity 0.6.12 : Javascript part //hash the data const hash = web3.utils.soliditySha3( myContractAddress, aCustomId, ); //prefix the hash const prefixedHash = ethUtil.hashPersonalMessage(ethUtil.toBuffer(hash)); //get the ECDSA signature and its r,s,v parameters const privateKey = new ...


1

Easy way: https://cointool.app Harder way: Source code: https://github.com/rstormsf/multisender/blob/master/contracts/contracts/multisender/UpgradebleStormSender.sol function multisendToken(address token, address[] _contributors, uint256[] _balances) public hasFee payable { uint256 total = 0; require(_contributors.length <= arrayLimit()); ERC20 erc20token ...


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