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 do I serialize transactions?

See original GitHub issue

Hey I’m getting a peculiar error from serializeTransaction():

Error: invalid object key - from (argument=“transaction”, value={“from”:“0x3f85a22c26cdd23d119d1e2c72ceb73f32d1270a”,“gasPrice”:“0x4a817c800”,“gas”:“0x5208”,“to”:“0x3535353535353535353535353535353535353535”,“value”:“0xde0b6b3a7640000”,“data”:“”,“nonce”:“0x0”}, key=“from”, version=4.0.41)

The executing code is:

const tx = await ethers.utils.resolveProperties(txData);
console.log({tx})
let unsignedTx = ethers.utils.serializeTransaction(tx).substring(2);
console.log({unsignedTx})

The log from tx is:

{ tx:
   { from: '0x3f85a22c26cdd23d119d1e2c72ceb73f32d1270a',
     gasPrice: '0x4a817c800',
     gas: '0x5208',
     to: '0x3535353535353535353535353535353535353535',
     value: '0xde0b6b3a7640000',
     data: '',
     nonce: '0x0' } }

Greatly appreciate any help.

PS: I ripped this directly from your ledger repo so its a bit puzzling.

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
ricmoocommented, Apr 3, 2020

If you’re going to write a Lib that follows a specification

Right, but ethers Provider is not meant to follow another specification. If I could go back in time, I’d have chosen a different name for Provider. Think of a PNG library with access to header fields; it would prolly use png.text and png.pixelDimensions instead of the equivalents the standard specifies png.tEXt and png.pHYs (case plays 4 important and interesting roles in the PNG standard).

The Provider is its own specification and not trying to copy or mimic something else, its just trying to offer all the functionality. It’s meant to abstract those things away, which gives us a chance to do less worse. 😃

Similarly, rather than “following the standard”, when EIP-712 is supported, it will like be called signer.signTypedData instead of signer.signTypedDataV4. The library as an abstraction layer means the library can take care of these things without the developer worrying about the legacy imposed by the JSON-RPC API. It does mean anyone switching between ethers and web3 will need to know to use eth_signTypedData_v4, but I also don’t expect most people to be switching frequently between these libraries…

Anyhoo, I think we discussed most of this in person, already? But I’m updating the ticket here for anyone who stumbles across it. 😃

Going to close it now, but feel free to continue commenting (anyone) or re-open it if you’d like. I do monitor closed issues. 😃

1reaction
GregTheGreekcommented, Dec 22, 2019

oh funny, its because you don’t accept from without a sig, that makes sense

Read more comments on GitHub >

github_iconTop Results From Across the Web

Serializing transactions - IBM
You might need to serialize the execution of one or more transactions. This typically occurs when the application logic was not designed to...
Read more >
Serializable Transactions | CockroachDB Docs
SERIALIZABLE isolation guarantees that even though transactions may execute in parallel, the result is the same as if they had executed one at...
Read more >
What does it mean to serialize a transaction?
Serialization means that the message is packed in a byte stream, which properties (like encoding, byte ordering, etc.) ...
Read more >
SERIALIZABLE Isolation - Vertica
SERIALIZABLE is the strictest SQL transaction isolation level. While this isolation level permits transactions to run concurrently, it creates the effect ...
Read more >
Serializable Transaction - Ask TOM
A serializable transaction operates in an environment that makes it appear as if there are no other users modifying data in the database, ......
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