Jeiwan / blockchain_go

A simplified blockchain implementation in Golang
4.12k stars 1.16k forks source link

gob: type elliptic.p256Curve has no exported fields #85

Open mithleshmeghwal0 opened 1 year ago

mithleshmeghwal0 commented 1 year ago

part_5 createwallet not working @Jeiwan

Anmilover commented 1 year ago

您好,邮件已查收。Anmi、

BryceWayne commented 1 year ago

@mithleshmeghwal0 Which code section?

mithleshmeghwal0 commented 1 year ago

@BryceWayne https://github.com/Jeiwan/blockchain_go/blob/f35aa3c3cacd9be7b2a6f31d0f550bcaf31c6e53/wallets.go#L87 its failing on this line Screeshot is from my local, so line number may differ

Screenshot 2565-12-26 at 11 34 34
BryceWayne commented 1 year ago

elliptic.p256Curve should have no exported fields, right? Because of p being lowercase. Inspecting further.

BryceWayne commented 1 year ago

Here is why. https://cs.opensource.google/go/go/+/refs/tags/go1.19.4:src/crypto/elliptic/nistec.go;l=35;drc=38cfb3be9d486833456276777155980d1ec0823e

The field is not accessible outside the file.

mithleshmeghwal0 commented 1 year ago

Yup, i inspected until this point, but can we do any work around this ?

BryceWayne commented 1 year ago

For context, https://stackoverflow.com/questions/32676898/whats-the-purpose-of-gob-register-method The problem is saving the wallets map so that we can always reconstruct the data... Just thinking out loud.

BryceWayne commented 1 year ago

One way might be to create your own type/interface to access to field... https://stackoverflow.com/questions/42664837/how-to-access-unexported-struct-fields

mithleshmeghwal0 commented 1 year ago

Yup, i will try to create interface and i will comment or probably create PR for this . Thanks @BryceWayne

mithleshmeghwal0 commented 1 year ago

@BryceWayne i tried to build a package with elliptic , but it still failed @Jeiwan

LangLiBa commented 1 year ago

@BryceWayne

https://github.com/Jeiwan/blockchain_go/blob/f35aa3c3cacd9be7b2a6f31d0f550bcaf31c6e53/wallets.go#L87

its failing on this line Screeshot is from my local, so line number may differ

Screenshot 2565-12-26 at 11 34 34

Did you fix these,please?

Anmilover commented 1 year ago

您好,邮件已查收。Anmi、

mithleshmeghwal0 commented 1 year ago

Seems @LangLiBa this repo is outdated, i created this issue long ago, there is no reply. I fixed this by using 1.18.9 go version. I could have pursued to fix this, but my objective was to learn blockchain, not to fix this

LangLiBa commented 1 year ago

Seems @LangLiBa this repo is outdated, i created this issue long ago, there is no reply. I fixed this by using 1.18.9 go version. I could have pursued to fix this, but my objective was to learn blockchain, not to fix this

Ok, thanks a lot.

BryceWayne commented 1 year ago

Seems @LangLiBa this repo is outdated, i created this issue long ago, there is no reply. I fixed this by using 1.18.9 go version. I could have pursued to fix this, but my objective was to learn blockchain, not to fix this

Thanks @mithleshmeghwal0

zzylmt commented 11 months ago

I'm getting the same error, how should I fix this problem

Anmilover commented 11 months ago

您好,邮件已查收。Anmi、

zzylmt commented 11 months ago

Is there another solution? Or please update the code based on the latest go version?thx.

atsuyaourt commented 8 months ago

Here is my workaround (see lns 89-143). Then remove ln 66 and ln 82 from wallets.go.

I implemented GobEncoder/GobDecoder interfaces to the Wallet struct so gob.Register(elliptic.P256()) can be removed.

Anmilover commented 8 months ago

您好,邮件已查收。Anmi、