Categorygithub.com/uwimchain/uwim.lib.go
modulepackage
0.0.0-20211224074907-3b39d5a49863
Repository: https://github.com/uwimchain/uwim.lib.go.git
Documentation: pkg.go.dev

# README

uwim.lib.go

Installation:

go get github.com/uwimchain/uwim.lib.go
import "github.com/uwimchain/uwim.lib.go"

Generate mnemonic phrase

mnemonic, err := uwim_lib_go.GenerateMnemonic()

To generate public , secret keys or addresses from a mnemonic phrase, you can use a ready-made mnemonic phrase.

Generation of a Seed string from a mnemonic phrase

seed, err := uwim_lib_go.SeedFromMnemonic(mnemonic)

Generating a secret key from a Seed string or mnemonic phrase

secret_key, err := uwim_lib_go.SecretKeyFromSeed(seed);<br><br>
secret_key, err := uwim_lib_go.SecretKeyFromMnemonic(mnemonic)

Generation of a public key from a secret key or mnemonic phrase

public_key, err := uwim_lib_go.PublicKeyFromSecretKey(secret_key)
public_key, err := uwim_lib_go.PublicKeyFromMnemonic(mnemonic)

Generating a user's address from a public key or mnemonic phrase

To generate an address, you can use a public key or a mnemonic phrase. You must also specify one of the three available prefixes. If you specify any other prefix, the function will return an error

Generation of an address with the "uw" prefix - the address of the user's wallet

uw_address, err := uwim_lib_go.AddressFromPublicKey(public_key, "uw")
uw_address, err := uwim_lib_go.AddressFromMnemonic(mnemonic, "uw")

Generation of an address with the "sc" prefix - the address of the smart contract

sc_address, err := uwim_lib_go.AddressFromPublicKey(public_key, "sc")
sc_address, err := uwim_lib_go.AddressFromMnemonic(mnemonic, "sc")

Generation of an address with the "nd" prefix – the address of the node.

nd_address, err := uwim_lib_go.AddressFromPublicKey(public_key, "nd")
nd_address, err := uwim_lib_go.AddressFromMnemonic(mnemonic, "nd")

Receiving a RAW transaction line for sending to the blockchain API

In order to generate a RAW transaction line, you need to specify such data as:

    Mnemonic phrase (the sender of the transaction);
    Sender's address (must be generated from a mnemonic phrase or match it);
    Recipient's address;
    The number of coins you want to transfer (for some transaction types or transaction subtypes, the number of coins may be zero);
    The designation of the token whose coins you want to transfer (for example: "uwm");
    Transaction subtype (for example: "default_transaction");
    Data of the comment to the transaction in JSON format (for each type or subtype of the transaction, its own comment data is indicated or not indicated at all);
    Transaction type (Number 1 or 3);
transaction_raw, err := uwim_lib_go.GetRawTransaction(
    mnemonic,
    sender_address,
    recipient_addres,
    amount,
    token_label,
    transaction_comment_title,
    transaction_comment_data,
    transaction_type
)

# Functions

No description provided by the author
Address.
ConvertBits converts a byte slice where each byte is encoding fromBits bits, to a byte slice where each byte is encoding toBits bits.
Decode decodes a bech32 encoded string, returning the human-readable part and the data part excluding the checksum.
Encode encodes a byte slice into a bech32 string with the human-readable part hrb.
No description provided by the author
Mnemonic.
No description provided by the author
No description provided by the author
PublicKey.
No description provided by the author
SecretKey.
Seed.
Signature.

# Variables

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Structs

No description provided by the author
TransactionRaw.
No description provided by the author
No description provided by the author