question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to properly encode a signedTransaction

See original GitHub issue

Dear Friends, Things are working properly when I load the Contract abi. I try to to achieve the same transaction without any abi. Her is my snippets :

const abi = [{ name: "setContenthash", type: "function", inputs: [{ type: "bytes32" }, { type: "bytes" }] }];
		const iface = new window.ethers.utils.Interface(abi)
		const data = iface.functions.setContenthash.encode([domainHash, encoded]);
		const tx = await web3Provider.sendTransaction({ from: account, to: resolverAddress, data: data });

domainHash, encoded and Web3Provider are setup correctly no issue on that side however while running I got :

invalid hexlify value (arg=“value”, value={“from”:“0x2d8f8ded6bcefe6c0cbb45d9d48487fce9ca8b90”,“to”:“0x12299799a50340FB860D276805E78550cBaD3De3”,“value”:“0x304e6ade0efab67953e4a35dccf4d5fd4fbad55492477d71efd737f0aee514b113ee792c00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000026e301017012203450ca71b83ff514dcff5047641bf1471caacdc35132b6f1165d318f9d7be5270000000000000000000000000000000000000000000000000000”}, version=4.0.39)

Any hints ?

By the way is there any proper place to talk about ethers.js ?

Thanks

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
ricmoocommented, Nov 21, 2019

Heya!

A big difference between Web3.js and ethers.js is the distinction between a Provider and Signer. The provider.sendTransaction is similar to the sendRawTransaction call. To send a transaction from an account, you need a Signer.

// This only works on JsonRpcProviders, and returns a JsonRpcSigner
const signer = provider.getSigner();
const resp = signer.sendTransaction(tx);

This will send the transaction to be signed by the node.

Let me know if that helps, or if there are still problems. This is as good a place as any to ask questions, but you can also use our Gitter. 😃

0reactions
xmaysonnavecommented, Nov 22, 2019

Thanks Richards. It works great. Removing the from: resolved my issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

What are the Steps for Encoding an Extrinsic in Substrate?
More generally, if you were to SCALE encode a signed transaction, you'd follow these steps: Combine the call , extra and additional data...
Read more >
Encoding and Decoding - Algorand Developer Portal
This can be done by msgpack encoding the transaction object on one side and msgpack decoding it on the other side. Often the...
Read more >
Sending a Raw Signed Transaction (Ethereum) - Medium
Encode (signature)) //signature. This will successfully generate a signed transaction but you need to provide the struct data as input in ...
Read more >
Building transactions - R3 Documentation
Any commands that are added to the transaction need to correctly reflect ... As a SignedTransaction we can pass the data around certain...
Read more >
Chapter 6: Transactions · GitBook
eth.sendSignedTransaction, which takes a hex-encoded and signed transaction and transmits it on the Ethereum network. Why would you want to separate the signing ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found