aepp-sdk-go

command module
v4.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 6, 2019 License: ISC Imports: 1 Imported by: 0

README

aepp-sdk-go

golang sdk for aeternity blockchain Go Report Card GoDoc

Usage

No matter what kind of transaction you're making, it always follows the same rules:

  1. Find the account nonce, get the transaction TTL (in blocks)
  2. Make the transaction
  3. Sign the transaction with a given network ID
  4. 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)
}

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL