main.go 351 B

123456789101112131415161718192021222324
  1. package main
  2. import (
  3. "blockchain-go/p2p"
  4. "blockchain-go/p2p/nat"
  5. "github.com/ethereum/go-ethereum/crypto"
  6. )
  7. func main() {
  8. key, _ := crypto.GenerateKey()
  9. config := p2p.Config{
  10. PrivateKey: key,
  11. Name: "p2p",
  12. NAT: nat.Any(),
  13. }
  14. server := &p2p.Server{
  15. Config: config,
  16. }
  17. err := server.Start()
  18. if err != nil {
  19. return
  20. }
  21. }