Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
mehcode committed Nov 5, 2019
1 parent 0395457 commit ace5b56
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 0 deletions.
46 changes: 46 additions & 0 deletions examples/create_account/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
package main

import "os"
import "github.com/hashgraph/hedera-sdk-go"

func main() {
client, err := hedera.NewClient(
// Node ID
AccountID { account: 3 },
// Node Address
"0.testnet.hedera.com:50211",
)

if err != nil {
panic(err)
}

operatorPrivateKey, err := hedera.Ed25519PrivateKeyFromString(os.Getenv("OPERATOR_KEY"))

if err != nil {
panic(err)
}

client.SetOperator(
// Operator Account ID
AccountID { account: 2 },
// Operator Private Key
operatorPrivateKey,
)

newKey := hedera.NewEd25519PrivateKey()
newPublicKey := newKey.PublicKey()

tx := hedera.NewAccountCreateTransaction(client).
SetKey(newPublicKey).
SetInitialBalance(1000).
SetMaxTransactionFee(10000000)

receipt, err := tx.ExecuteForReceipt()

if err != nil {
panic(err)
}

newAccountID := receipt.AccountID()
}
3 changes: 3 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module github.com/hashgraph/hedera-sdk-go

go 1.13
1 change: 1 addition & 0 deletions index.go
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package hedera

0 comments on commit ace5b56

Please sign in to comment.