LanaCoin Technical Documentation

Return to Home

🌐 LanaCoin Developer Guide: Transaction Signing & Broadcasting

This guide provides a complete, implementation-agnostic reference for signing and broadcasting LanaCoin (LANA) transactions. It's designed for developers working with JavaScript, Python, Java, or raw binary-level code.

🔍 Overview

LanaCoin transactions are modeled after Bitcoin's P2PKH structure, with key distinctions:

🔑 Key Components

1. Private Key (WIF Format)

2. Public Key & Address

Public Key: Derived using secp256k1 (0x04 + X + Y) → Uncompressed

Address:

pubKeyHash = RIPEMD160(SHA256(pubkey))
address = Base58Check(0x30 + pubKeyHash)

🧱 Transaction JSON Format

{
  "version": 1,
  "nTime": 1711562800,
  "inputs": [
    {
      "txid": "abc123...",
      "vout": 0,
      "value": 100780000,
      "scriptPubKey": "76a914...88ac",
      "sequence": 4294967295
    }
  ],
  "outputs": [
    {
      "pubKeyHash": "20-byte hex",
      "amount": 300000
    },
    {
      "pubKeyHash": "20-byte hex",
      "amount": 100470000
    }
  ],
  "locktime": 0
}

Note: Supports multiple UTXO inputs and outputs. nTime is required.

✍️ Signing Process (Language-Neutral)

Step 0: Insert nTime

Insert a 4-byte UNIX timestamp immediately after the version.

Step 1: Build the Preimage

For each input:

Step 2: Sign

Step 3: Construct scriptSig

scriptSig = [<length of DER+01>] [DER signature + 0x01] [<length of pubkey>] [pubkey]

Example (for uncompressed pubkey):

[0x48] [DER_SIGNATURE+01] [0x41] [0x04 + X + Y]

Step 4: Assemble Final TX

Replace placeholder scriptSig with real one

Serialize fields in this order:

🚀 Broadcasting Options

1. ElectrumX JSON-RPC

Endpoint: tcp://electrum1.lanacoin.com:5097

Request:

{
  "id": 0,
  "method": "blockchain.transaction.broadcast",
  "params": ["<signed_tx_hex>"]
}

2. Electrum CLI

electrum --server electrum1.lanacoin.com:5097:t broadcast <hex_tx>

3. Explorer API

(Coming Soon — will depend on hosted explorer)

🧯 Common Errors

Error Code Meaning Likely Cause
-22 TX decode failed Invalid structure or script formatting
-22 TX rejected Bad signature, missing SIGHASH flag
-26 Non-canonical signature DER encoding issue, wrong pubkey format
No response nTime missing LanaCoin requires nTime after version

✅ Required Elements Summary

Field Format / Notes
Version 0x01000000 (4 bytes, LE)
nTime UNIX timestamp (4 bytes, LE)
ScriptPubKey 76a914{20-byte pubKeyHash}88ac
ScriptSig PUSH(DER_SIG+01) + PUSH(uncompressed pubkey)
SIGHASH Flag 0x01
Address Prefix 0x30 (Base58Check L...)
WIF Prefix 0xB0 (Base58Check starts with 6...)

🧠 Developer Notes

🔥 What Will Fail Validation