decodepay

package module
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: May 3, 2026 License: MIT Imports: 8 Imported by: 0

README

flndecodepay

MIT licensed GoDoc

Simple Flokicoin Lightning Network BOLT11 invoice decoder with outputs similar to c-lightning using code from flnd.

This is a fork of ln-decodepay adapted for the Flokicoin Lightning Network.

install
go get -u github.com/flokiorg/flndecodepay
use
package main

import (
	"encoding/json"
	"fmt"

	decodepay "github.com/flokiorg/flndecodepay"
)

func main() {
	// Decode a Flokicoin Lightning invoice (lnfc prefix)
	bolt11, _ := decodepay.Decodepay("lnfc50n1p5hxs4npp5smus34m4mzd2jk7gepqkx9j89w2ukrjfajrvevwgslklzgt8l4zsdqqcqzvsxqyz5vqrzjqwz8th0q6p25q5wcvxh2s75n960tm3tung3vc7lmmmcdltt98pjs9apyqqqqqqqqqyqqqqlgqqqqqeqpjqrzjqtnr4hly8edgpl5wvcx86ekcc2rezdnq2calx5xpwk92l50qscwteapyqqqqqqqqquqqqqlgqqqqqeqpjqrzjqwz8th0q6p25q5wcvxh2s75n960tm3tung3vc7lmmmcdltt98pjs9apyqqqqqqqqqgqqqqlgqqqqqeqpjqsp5ge3wl84an6d34x6r7hm82thlg7vgwdffec5xnut90uwj3fvtaqjs9qxpqysgq6rp4rv2lgkffvd239dmj4ehg7vfxuuulu2amjpjf3rrhjhyay0djvjj8hn95rlz9g2kudqmqhw49urrxm6fhnzx6htwpjv6hj3k53hcq7qxkwk")
	j, _ := json.MarshalIndent(bolt11, "", "  ")
	fmt.Println(string(j))
}

outputs

{
  "currency": "fc",
  "created_at": 1769161395,
  "expiry": 86400,
  "payee": "03c9a6e09e2e9d1529c87c034891e05ddf32343fad7a9af563b9de6958c95f5990",
  "mloki": 5000,
  "payment_hash": "86f908d775d89aa95bc8c8416316472b95cb0e49ec86ccb1c887edf12167fd45",
  "min_final_cltv_expiry": 400,
  "routes": [
    [
      {
        "pubkey": "038475dde0d0554051d861aea87a932e9ebdc57c9a22cc7bfbdef0dfad65386502",
        "short_channel_id": "16000000x0x1",
        "fee_base_mloki": 1000,
        "fee_proportional_millionths": 100,
        "cltv_expiry_delta": 400
      }
    ]
  ]
}
Supported currencies
  • lnfc - Flokicoin mainnet
  • lnfcrt - Flokicoin regtest
  • lnfct - Flokicoin testnet

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bolt11

type Bolt11 struct {
	Currency           string  `json:"currency"`
	CreatedAt          int     `json:"created_at"`
	Expiry             int     `json:"expiry"`
	Payee              string  `json:"payee"`
	MLoki              int64   `json:"mloki"`
	Description        string  `json:"description,omitempty"`
	DescriptionHash    string  `json:"description_hash,omitempty"`
	PaymentHash        string  `json:"payment_hash"`
	MinFinalCLTVExpiry int     `json:"min_final_cltv_expiry"`
	Route              [][]Hop `json:"routes,omitempty"`
}

func Decodepay

func Decodepay(bolt11 string) (Bolt11, error)

type Hop

type Hop struct {
	PubKey                    string `json:"pubkey"`
	ShortChannelId            string `json:"short_channel_id"`
	FeeBaseMloki              int    `json:"fee_base_mloki"`
	FeeProportionalMillionths int    `json:"fee_proportional_millionths"`
	CLTVExpiryDelta           int    `json:"cltv_expiry_delta"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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