aepp-sdk-go
golang sdk for aeternity blockchain
Usage
No matter what kind of transaction you're making, it always follows the same rules:
- Find the account nonce, get the transaction TTL (in blocks)
- Make the transaction
- Sign the transaction with a given network ID
- Broadcast it to a node of your choosing
acc, err := aeternity.AccountFromHexString(senderPrivateKey)
if err != nil {
fmt.Println(err)
return
}
aeNode := aeternity.NewCli("http://localhost:3013", false).WithAccount(acc)
Most parameters are set by modifying the variables in config.go
in this manner:
aeternity.Config.Client.Fee = *utils.RequireBigIntFromString("100000000000000")
When using the Ae/Aens/Contract/Oracle
struct helper functions in helpers.go
, chores like getting the TTL, Account Nonce, encoding of the AENS claim etc are done automatically.
preclaimTx, salt, err := aeNode.Aens.NamePreclaimTx("fdsa.test", aeternity.Config.Client.Fee)
if err != nil {
fmt.Println(err)
return
}
preclaimTxStr, err := aeternity.BaseEncodeTx(&preclaimTx)
signedTxStr, hash, signature, err := aeternity.SignEncodeTxStr(acc, preclaimTxStr, "ae_docker")
if err != nil {
fmt.Println(err)
return
}
err = aeNode.BroadcastTransaction(signedTxStr)
if err != nil {
panic(err)
}