4

If you've heard about the ethers js library, it provides a fantastic function named parseTransaction, I found it after a very long search as it wasn't mentioned in any online forums and I'm still learning a lot about this stuff. But I found it to be the best for decoding any sort of contract and associated function call. const ethers = require('ethers')...


3

What you are asking for is an Oracle. Check out Tellor. It's the simplest one out there to integrate directly in your contracts.


3

You can get both using the web3 instance of web3.js: const networkId = await web3.eth.net.getId(); const chainId = await web3.eth.getChainId();


2

try change data :'' to data:"0x"


2

After reviewing how ethereumjs-block:Block.genTxTrie() does it, I managed to figure it out: const trie = new Trie() await Promise.all(transactionsRaw.map((t, i) => new Promise(resolve => { trie.put( rlp.encode(i), new Transaction(t).serialize(), resolve ) }) )) or const trie = new Trie() const put = util.promisify(trie....


2

Saying Chainlink is "not decentralized enough" is a lot like saying "a tree is not a forest enough". Chainlink is a framework for connecting off-chain data to smart contracts in a decentralized manner. In the same sense that one Ethereum node is a part of the whole decentralized ecosystem, one Chainlink node is apart of the whole ...


2

The network is very busy right now, resulting in higher gas prices. If you use a gas price that is too low, your transaction will take a lot longer to confirm. I recommend that you use ETH Gas Station to see what gas price you should use. You can read more about gas in general here: https://support.mycrypto.com/general-knowledge/ethereum-blockchain/what-is-...


2

You can do this way : const EthereumTx = require('ethereumjs-tx').Transaction; import Common from 'ethereumjs-common'; const customCommon = Common.forCustomChain( 'mainnet', { name: 'my-private-blockchain', networkId: NETWORK_ID, chainId: CHAIN_ID, }, 'istanbul', ); ...


2

For approach #2, sending a transaction without signing it first is supported only if you unlock your account on the node that you're communicating with beforehand (for example, when you run your tests on Ganache). On public nodes, this is obviously not feasible (neither would you want it to be, of course). You'll need to sign the transaction first, and ...


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(...


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

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 ...


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

You can look at the receipt of the transaction to verify the data yourself. The web3.js library's sendSignedTransaction will return a receipt that you can check to verify the data. Edit based on goodvibration's comments My original answer was as follows: A signed transaction cannot be altered, as the data within the transaction has already been signed. If ...


1

Web3 1.2.5 supports the revert messages now, activated by setting web3.eth.handleRevert = true. You can use TestContract.methods.myMethod(myParam).call().catch(console.log) to receive the message without sending the transaction. See https://soliditydeveloper.com/web3-1-2-5-revert-reason-strings for more details.


1

In Ethereum you pay for each byte sent - whether it's to a smart contract or to an EOA (externally owned address). With smart contracts you also pay for the execution (and for the initial contract deployment). I would say this depends on what you want to do with the data. IF you simply send a transaction with arbitrary data to any address it's possible but ...


1

The price feeds / reference contracts work as you described: Independent Chainlink nodes collect data from highly respected APIs They place the data on-chain Other services make calls to the reference contracts The price given is considered the last price which is what most all exchanges consider to be the "market" price. Most exchanges have some ...


1

You should definitely check https://github.com/Web3Modal/web3modal, it has many providers that you can check out. Also, for easy onboarding web2 users into your dApp you should check Abridged or Unilogin


1

The best method is to keep your private keys off the Go Ethereum (geth) server and sign transactions locally. Namely, there are a lot of stateless Ethereum node services like Infura and QuikNode that do not support accounts. Import your private key and create web3.eth.acccounts.Account object. https://web3js.readthedocs.io/en/v1.2.7/web3-eth-accounts.html#...


1

Smart contracts can not autoexecute, they should always be triggered by a transaction. In your case you have a contract A and a contract B. When contract B balance is below a particular values you want contract A to do something. The easiest way to do this is to write a function in contract B to call contract A everytime that contract B is called. Like ...


1

Literals refer to fixed values that the program may not alter during its execution. These fixed values are also called constants. Generally, both terms, constants and literals are used interchangeably.


1

call does not return a receipt but the actual value of the function, as it is executed locally on the node. However the returned object is a promise, so you need to await it.


1

In the options object passed to the signTransaction function, add this: to: transaction._parent._address Note that if this (which you have masked out) fails: await transaction.estimateGas({ from: account.address }) Then the actual transaction will fail too. So there is no point masking it out; you should investigate why your function reverts.


1

Sending a transaction without signing it first is supported only if you unlock your account on the node that you're communicating with beforehand (for example, when you run your tests on Ganache). On public nodes, this is obviously not feasible (neither would you want it to be, of course). You'll need to sign the transaction first, and then send the signed-...


1

Please check this tool. You need to make your javascript browser compatible to use require() features.


1

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


1

When you start geth node, by default it connects to mainnet. If you want to setup a private network, you should set --networkId to some random number and should not belong to any existing network. You can refer to following tutorial for setting up a private network. https://medium.com/coinmonks/ethereum-setting-up-a-private-blockchain-67bbb96cf4f1 You can ...


1

In my experience, the error: TypeError: Member "error" not found or not visible after argument-dependent lookup in type(library Assert) is saying that its looking through the Assert library and there's not a function named "equal" with a type signature matching what you're trying to pass. In this case it looks like the Assert.equal ...


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