# SUI批量创建钱包地址脚本 **Published by:** [BSD](https://paragraph.com/@bsd/) **Published on:** 2022-11-16 **URL:** https://paragraph.com/@bsd/sui ## Content 批量生成SUI钱包地址本地保存 脚本语言:go 版本:go1.19 Discord交流: Link Twitter:@ananpt0package main import ( "encoding/json" "fmt" "github.com/coming-chat/go-sui/account" "github.com/tyler-smith/go-bip39" "io/ioutil" ) type SuiWallet struct { Address string `json:"address"` Mnemonic string `json:"mnemonic"` Private string `json:"private"` Public string `json:"public"` } func Create(num int) { fmt.Printf("[+]Create Wallet :%d \n", num) wallets := make([]SuiWallet, 0) for i := 0; i < num; i++ { fmt.Printf("[+]Wallet : %d \n", i+1) entropy, _ := bip39.NewEntropy(256) mnemonic, _ := bip39.NewMnemonic(entropy) fmt.Println("[+]Mnemonic : ", mnemonic) acc, _ := account.NewAccountWithMnemonic(mnemonic) fmt.Printf("[+]privateKey = %x\n", acc.PrivateKey[:32]) fmt.Printf("[+] publicKey = %x\n", acc.PublicKey) fmt.Printf("[+] address = %v\n", acc.Address) wallet := SuiWallet{} wallet.Mnemonic = mnemonic wallet.Address = acc.Address wallet.Private = fmt.Sprintf("%x", acc.PrivateKey[:32]) wallet.Public = fmt.Sprintf("%x", acc.PublicKey) wallets = append(wallets, wallet) } //保存到本地json文件 walletsJson, _ := json.Marshal(wallets) ioutil.WriteFile("wallet.json", walletsJson, 0666) } func main() { //创建100个钱包地址 Create(100) } 开始创建 ## Publication Information - [BSD](https://paragraph.com/@bsd/): Publication homepage - [All Posts](https://paragraph.com/@bsd/): More posts from this publication - [RSS Feed](https://api.paragraph.com/blogs/rss/@bsd): Subscribe to updates - [Twitter](https://twitter.com/ananpt0): Follow on Twitter