DEV Community

Discussion on: Building a Blockchain in Go Pt V - Wallets

Collapse
 
maxbridgland profile image
Max Bridgland

Great tutorial! I've been following along and I came across an issue, it looks like you might have left out the MakeWallet() function to create wallets initially. AddWallet() does not work because MakeWallet is undefined.

Collapse
 
nheindev profile image
Noah Hein

AddWallet is in the wallets.go file, and MakeWallet is in the wallet.go file

Make sure you have "package wallet" declared as the first line in each of your files. You should be able to make any calls that share a package regardless of which file you are currently located in.

If you are using VSCode it can sometimes be a bit wonky. when having such problems I pull up the command pallet and use ">Go: Restart Language Server".

Thanks for commenting. I hope this helped!

Collapse
 
maxbridgland profile image
Max Bridgland

I can't seem to find anywhere in your code where you put a MakeWallet function, I see CreateWallets but no MakeWallet. I assumed that it would be something like this:

func MakeWallet() *Wallet {
private, pub := NewKeyPair()
wallet := Wallet{private, pub}
return &wallet
}

Looking forward to your coming tutorials! Thanks for all the hard work

Thread Thread
 
nheindev profile image
Noah Hein

You are entirely correct. I had only checked the repl and not the actual blog post.

My mistake, thanks for catching it!

You are also correct about how the method is implemented. I just updated the post for people that go through it in the future.

Thanks so much for the feedback max!