Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hi, Is there an example of sending iota transactions in iota.go/v2? #4

Open
ygcool opened this issue Nov 4, 2021 · 0 comments
Open

Comments

@ygcool
Copy link

ygcool commented Nov 4, 2021

My private key and address creation example:

package main

import (
	"crypto/rand"
	"encoding/hex"
	"fmt"
	iotago "github.com/iotaledger/iota.go/v2"
	"github.com/iotaledger/iota.go/v2/ed25519"
)

func main() {
	publicKey, privateKey, err := ed25519.GenerateKey(rand.Reader)
	if err != nil {
		panic(err)
	}
	fmt.Println("Private key --- ", hex.EncodeToString(privateKey.Seed()))
	addr := iotago.AddressFromEd25519PubKey(publicKey)
	fmt.Println("Address --- ", addr.Bech32(iotago.PrefixTestnet))
}

How can I create a transaction and send it?
Can you provide an example?
thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant