Go
1
Create a new Go project:
go mod init example/radius
2
Install the Radius Go SDK:
go get github.com/radiustechsystems/sdk/go
3
Create a Go file called main.go
:
package main
import (
"context"
"log"
"math/big"
"github.com/radiustechsystems/sdk/go/radius"
)
// Replace the following values with your own
const (
RADIUS_ENDPOINT = "https://rpc.testnet.radiustech.xyz/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
PRIVATE_KEY = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
)
func main() {
client, err := radius.NewClient(RADIUS_ENDPOINT)
account := radius.NewAccount(radius.WithPrivateKeyHex(PRIVATE_KEY, client))
recipient, err := radius.AddressFromHex("0x...") // Replace with recipient address
amount := big.NewInt(100)
receipt, err := account.Send(context.Background(), client, recipient, amount)
log.Printf("Transaction hash: %s", receipt.TxHash.Hex())
}
4
Run the code using the following command:
go run main.go
Last updated
Was this helpful?