gada

package module
v0.0.0-...-5d200cf Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2024 License: Apache-2.0 Imports: 0 Imported by: 0

README


Go Cardano Serialization Library

GoDoc

This is the fork of Golang library for serialization and deserialiation of Cardano data structures.

Installation

go get github.com/milos-ethernal/go-cardano-serialization

Usage

Creating a simple transaction

The simplest transaction on Cardano network contains inputs(Unspent Transaction Outputs) and output.

package main

import (
    "log"

    "github.com/milos-ethernal/go-cardano-serialization/address"
    "github.com/milos-ethernal/go-cardano-serialization/tx"
)

func main() {
    adaTx := tx.NewTx()
    adaTx.AddInput(
        tx.NewInput(
            "TX_HASH", // Transaction Hash
            0,         // Transaction Index
            10000000   // Lovelace value of UTXO
        )
    )

    receiverAddr, err := address.NewAddress("addr1bech32_receiver_address_here")
    if err != nil {
        log.Fatal(err)
    }

    adaTx.AddOutput(
        tx.NewOutput(
            receiverAddr,
            5000000
        )
    )

    // Set an estimated transaction cost
    adaTx.SetFee(170000)

    // Set the transaction's time to live
    adaTx.SetTTL(505050505)

    // Encode example transaction to cbor hex.
    fmt.Println(adaTx.Hex())
}

More examples covering building through signing and submission of transactions can be found in the examples folder.

License

Licensed under the Apache License 2.0, see LICENSE

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
examples
internal
bech32/cbor
Package cbor is a modern CBOR codec (RFC 8949 & RFC 7049) with CBOR tags, Go struct tags (toarray/keyasint/omitempty), Core Deterministic Encoding, CTAP2, Canonical CBOR, float64->32->16, and duplicate map key detection.
Package cbor is a modern CBOR codec (RFC 8949 & RFC 7049) with CBOR tags, Go struct tags (toarray/keyasint/omitempty), Core Deterministic Encoding, CTAP2, Canonical CBOR, float64->32->16, and duplicate map key detection.

Jump to

Keyboard shortcuts

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