-
Notifications
You must be signed in to change notification settings - Fork 6
Basic Functions
Yevhen edited this page Jun 22, 2021
·
5 revisions
package main
import (
"fmt"
crypto "github.com/proximax-storage/go-xpx-crypto"
)
func main() {
KeyPair, _ := crypto.NewRandomKeyPair()
fmt.Printf("PublicKey:\t%x\n", KeyPair.PublicKey.Raw)
fmt.Printf("PrivateKey:\t%x", KeyPair.PrivateKey.Raw)
}
- The Address structure describes an public Address, NetworkType.
- first param - A public key in hex.
- second param - A NetworkType:
- MainNet = Main net network.
- TestNet = Test net network.
- Mijin = Mijin net network.
- MijinTest= Mijin test net network.
- Return - An Address struct
package main
import (
"fmt"
"github.com/proximax-storage/go-xpx-chain-sdk/sdk"
)
func main() {
publicKey := "04dd376196603c44a19fd500492e5de12de9ed353de070a788cb21f210645613"
Address, _ := sdk.NewAddressFromPublicKey(publicKey, sdk.MijinTest)
fmt.Printf("Address:\t\t%v\n", Address.Address)
fmt.Printf("NetworkType:\t%v", Address.Type)
}
- The Account structure describes an account private key, public key and address.
- first param - A private key in hex.
- second param - A NetworkType:
- MainNet = Main net network.
- TestNet = Test net network.
- Mijin = Mijin net network.
- MijinTest= Mijin test net network.
- Return - A Account struct
package main
import (
"fmt"
"github.com/proximax-storage/go-xpx-chain-sdk/sdk"
)
const alicePrivateKey = "04dd376196603c44a19fd500492e5de12de9ed353de070a788cb21f210645613"
func main() {
aliceAccount, _ := sdk.NewAccountFromPrivateKey(alicePrivateKey, sdk.MijinTest, nil)
fmt.Printf("Address:\t%v\n", aliceAccount.Address)
fmt.Printf("PrivateKey:\t%x\n", aliceAccount.KeyPair.PrivateKey.Raw)
fmt.Printf("PublicKey:\t%x", aliceAccount.KeyPair.PublicKey.Raw)
}
- Home
- Installation
-
Examples
- Basic functions
- Get Accounts info
- Get Transactions info
- Get Mosaic info
- Get Mosaic Levy info
- Get Namespace info
- Get BlockChain info
- Get Network info
- Get Metadata info
- Get Nem Metadata info
- Get Account Properties info
- Get Exchange info
- Get SDA-SDA Exchange info
- Get Secret lock info
- Get Storage info
- Announces a transaction
- Websocket