omgnetwork / omg-js

JavaScript Library for communication with OMG network
Apache License 2.0
42 stars 15 forks source link

Higher level description of the signing process #335

Closed dnikolovv closed 3 years ago

dnikolovv commented 3 years ago

Hi guys!

I'm working on an OMG client implementation in another language.

While the APIs themselves are understandable and the examples + a bit of fiddling with the Network tab can provide great insights - there is one thing that's very hard to port - signing.

Messing up the signing means you just get submit:malformed_witnesses on transaction.submit which doesn't really help with debugging.

Is there a higher level description of the process somewhere? I tried simply deciphering the code, but there are some bits that are just too JS specific to port, at least for me.

Making it easier to create client libraries in other languages would be a nice step towards more adoption.

kevsul commented 3 years ago

Hi, I don't know if you've seen this already, but we have an explanation on how to create and sign transactions here:

https://docs.omg.network/network/transfers

OMG network uses EIP-712 signing, which is more complex but allows wallets to show users exactly what they're signing (instead of just a blob of data). If you need to create your own transactions, then you'll need to find an eip712 library for the language you're using, or implement it yourself.

You can avoid that though, by using the transaction.create api - that will return the eip712 typed data to you, which you just need to sign using elliptic curve signing (same curve that ethereum uses)

nicholasmueller commented 3 years ago

closing with above comment 👆