74a9dfbdca
here a new subcommand is added: `address`. the idea here is to provide an example of how address-related funcionality from `pkg/monero` can be used. at the moment, the only available action is "generate", which instantiates a new seed based on `crypto/rand` and then displaying on stdout the result WARNING: DO NOT USE THIS FOR ANYTHING MEANINGFUL. you've been advised. example: $ monero address generate Mnemonic: dawn repent towel taxi cucumber muzzle romance awesome losing yeti dogs biplane foyer hotel tattoo dilute gearbox later afloat purged software ashtray cell dangerous biplane Primary Address: 49MYaXwy8K177bw9i1bBDvPuM... Private Spend Key: 455f1c286ff8db620e61ca6c6... Private View Key: b5d26a403c6cec29c3ecc8d2f... Public Spend Key: cc06a0f6e6c6b0248d5e2c3fd... Public View Key: bcb8d3dc372efb9071c120b72... (output truncated to fit the commit message). Signed-off-by: Ciro S. Costa <utxobr@protonmail.com>
30 lines
621 B
Go
30 lines
621 B
Go
package monero
|
|
|
|
import "fmt"
|
|
|
|
// Network denotes a type of Monero network to gather information about.
|
|
//
|
|
type Network string
|
|
|
|
const (
|
|
NetworkMainnet Network = "mainnet"
|
|
NetworkTestnet Network = "testnet"
|
|
NetworkStagenet Network = "stagenet"
|
|
NetworkFakechain Network = "fakechain"
|
|
)
|
|
|
|
func (n Network) PublicAddressBase58Prefix() []byte {
|
|
switch n {
|
|
case NetworkMainnet:
|
|
return []byte{18}
|
|
case NetworkTestnet:
|
|
return []byte{53}
|
|
case NetworkStagenet:
|
|
return []byte{24}
|
|
case NetworkFakechain:
|
|
return NetworkMainnet.PublicAddressBase58Prefix()
|
|
}
|
|
|
|
panic(fmt.Errorf("'%s' is not a valid netowrk", n))
|
|
}
|