fbsobreira / gotron-sdk

Tron SDK for golang / CLI tool with keystore manager
GNU Lesser General Public License v3.0
322 stars 206 forks source link

fix(keystore): support for build without cgo #135

Open subnix opened 4 months ago

subnix commented 4 months ago

CGO and especially go-ethereum/crypto/secp256k1 adds significant overhead to build time/size. Also it doesn't allow us to build on some platforms at all. go-ethereum has a cgo-safe wrapper for secp256k1.RecoverPubkey - crypto.Ecrecover. So we can use it to fix the problem. https://github.com/ethereum/go-ethereum/blob/6bb13e8e2be3aa8c41460eb11837baba514e19be/crypto/signature_cgo.go#L31-L34 https://github.com/ethereum/go-ethereum/blob/6bb13e8e2be3aa8c41460eb11837baba514e19be/crypto/signature_nocgo.go#L32-L40

Fixes #111, Fixes #125, Fixes #103

P.S. Looks like it should resolve windows building issues, but I can't check it.

subnix commented 1 month ago

@fbsobreira could you take a look, please? It's a really small change that will significantly improve building and portability.

jwrookie commented 1 month ago

look good for me