here is my code :

package main
import (
    "fmt"
    "math/big"
    "log"
    "os"
    
    "github.com/btcsuite/btcd/btcec"
    "github.com/btcsuite/btcd/chaincfg"
    "github.com/btcsuite/btcutil"
    "github.com/btcsuite/btcutil/base58"
)

func main() {
    // Print header
    
    
    // Initialise big numbers with small numbers
    count, one := big.NewInt(0), big.NewInt(9000000000000000000)
    
count.SetString("102987336249554097029535212322581322789799900648198034993379397001115665086549",10)

    // Create a slice to pad our count to 32 bytes
    padded := make([]byte, 32)

    // Loop forever because we're never going to hit the end anyway
    for {
        // Increment our counter
        count.Add(count, one)

        // Copy count value's bytes to padded slice
        copy(padded[32-len(count.Bytes()):], count.Bytes())

        // Get public key
        _, public := btcec.PrivKeyFromBytes(btcec.S256(), padded)

        // Get compressed and uncompressed addresses
        caddr, _ := btcutil.NewAddressPubKey(public.SerializeCompressed(), 
&chaincfg.MainNetParams)
        decoded, version, err := base58.CheckDecode(caddr.EncodeAddress())
            if err != nil {
             fmt.Println(err)
            return
            }
            
        // Print keys
           str := fmt.Sprintf("%49s\n", big.NewInt(0).SetBytes(decoded), 
version)

        // Create a new file called file.txt.
           f, err := os.Create("file.txt")
           if err != nil {
           log.Fatalln(err)
           }
           
        // Close the file when we're done.
           defer f.Close()
        
        // Create and write to a new file called file.txt.
           for {
           _  , err = f.WriteString(str)
           }
          if err != nil {
          log.Fatalln(err)
    }
          fmt.Printf(str)
    }
}

result : in file.txt

%!(EXTRA uint8=0)1249045137724672133690259881462329489226509877080
%!(EXTRA uint8=0)1249045137724672133690259881462329489226509877080
%!(EXTRA uint8=0)1249045137724672133690259881462329489226509877080
%!(EXTRA uint8=0)1249045137724672133690259881462329489226509877080
%!(EXTRA uint8=0)1249045137724672133690259881462329489226509877080
%!(EXTRA uint8=0)1249045137724672133690259881462329489226509877080

ect.......


-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to