hengxin-kernel-endpoint

command module
v0.0.0-...-7ae82dc Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2020 License: LGPL-3.0 Imports: 1 Imported by: 0

README

Hengxin Kernel Endpoint

Hengxin Network是Hengxin的无币区块链解决方案,采取了数据链下加密存储,数据文件hash上链的方式,提供了一套完整的无币区块链解决方案。

Hengxin Kernel作为Hengxin Network的核心链,将负责所有链上相关的行为。

编译运行

在运行此程序之前,你需要先部署Hengxin Network

go get github.com/fox-one/hengxin-kernel-endpoint
hengxin-kernel-endpoint http --port 8082 --host localhost --kernel-node localhost:8239

Read Snapshots

GET /snapshots

Param:

since=12345 // snapshot topology, default 0
count=1     // default 100, max 500

Response:

{
  "code": 0,
  "data": [
    {
      "hash": "16c8589547309b36cfae2f05f7f72ee81fd1d6dd503783f09eb0deca15c7c88f",
      "transaction": {
        "hash": "68a32c2e9207f36e7e213581d7060a539793f464dbf464de7aae34bedc904263",
        "version": 1,
        "asset": "b9f49cf777dc4d03bc54cd1367eebca319f8603ea1ce18910d09e2c540c630d8",
        "inputs": [
          {
            "hash": "61117a9b3c6ea39961e7d4be8dc6209b9b335df912f19fe76e389df6192e5f62",
            "index": 1
          }
        ],
        "outputs": [
          {
            "type": 0,
            "amount": "0.00451498",
            "keys": [
              "4cfad894279657e5ef4867d935242458329464518ac8bf9cbb9b002baae63516"
            ],
            "script": "fffe01",
            "mask": "e52bca9f6963f64530392d2bf01a5af73ee97136bb90627c88851b35caed3093"
          },
          {
            "type": 0,
            "amount": "0.96207992",
            "keys": [
              "390b2e9499c46874bc23748e16ce1ea24b14bb48094c4ac24d810640b7c42bf9"
            ],
            "script": "fffe01",
            "mask": "84cff00593d104dd6f1f387afc5ed3fe4f1801cc58152ced358187a57d80217b"
          }
        ],
        "extra": "0b7a394afb573033b191e95e22212567"
      },
      "topology": 12345678,
      "timestamp": 1573217783356792600,
      "signature": "bfc7d865f3ca5a1506c2e4631c2b0b4ff40dc32594a64e86c36efbae1b644d8fd996c720bb0a07dfa0a071d6c1eae48c5ac2ab4b89f33fab84790809fc2c320a000000007bf87cce"
    }
  ]
}

Read Transaction

GET /transaction/{tx_hash}

Response:

{
  "code": 0,
  "data": {
    "hash": "547d13134ef5b76f3fc498e45540f907fa2d797d5745345eccf27b62660ed10e",
    "version": 1,
    "asset": "a99c2e0e2b1da4d648755ef19bd95139acbbe6564cfb06dec7cd34931ca72cdc",
    "inputs": [
      {
        "hash": "a9c919e0f725450e159c5ebe7394f626f34bb545216fb9ca55cd65aacbdc64c4",
        "index": 1
      }
    ],
    "outputs": [
      {
        "type": 0,
        "amount": "4.10958903",
        "keys": [
          "04916d83d01d0ec63f7d79bfb84394dd5aad82a598eecd3b4c04ad9411a73115"
        ],
        "script": "fffe01",
        "mask": "42ffab9fd078811fe40c71818e0759ba986f7061e9bc8d231456eb0a6a7f7ab9"
      }
    ],
    "extra": "37386133643264652d333836312d346663662d623835622d323863636133333161333432",
    "snapshot": "70b3c2a2fe6a9233a3c98872de5b8281e1aa0d1a6469427c4a6cd41593f43967"
  }
}

Read UTXO

GET /utxo

Param:

tx_hash: hash   // output transaction hash
index: 0        // output index

Response:

{
  "code": 0,
  "data": {
    "hash": "2d259a9cbe49eccd7878112e291e378fee7c08af0b443c598b1fbc091d7345fc",
    "index": 0,
    "type": 164,
    "amount": "10000.00000000",
    "keys": [
      "0aae744fd846edc0ca46ad4026749b8a60edfbcdb6de028917e4186265a95e2b",
      "8e14567b50e7891381d2fcbe6d357a34d49336584152c6a0200f958af9362be5",
      "95c21998d84d9ffeb82ff24de7576b9b34eff85e3237870d7d0a4077df82e28d",
      "68d905700886bd7ba73d0c127cd4e7cd040f27700cd7bdb4e1fcc8f500dcfd3c",
      "078b6bf97750f508e1fab23cdae727112a58816ed0a4e344f5b5b004c3220515",
      "664d5697950ac4e55290e52ff85d9579cd8515f91e238f0b8bab13c542a7c2d7",
      "91a57ede6d00b4cfb7f3adc97f7b93287eeb5a0eb53588dc36546db02fd65694",
      "846e69184ee829dc38f42d9d42bd1fb909e35c78e7ace569d2e56c57c93cf9be",
      "d1ad8b996ec4a04d9feb160d99a4a872526569b5091ddf3fa84ccbf28bca5dad",
      "b11a8f46f5c2e48946be4c9aef6c5a0c9545fe7fdbbc86f7c0c9724d783006fd",
      "9af8f9c3879dd6663c29a27acc7113d134e1e8ffaf1867cb52e1ad631c6f8edf",
      "ceb505f3014a7b0a055b4473871b097c9ea91a8e1a638edf0daee241f423b829",
      "bb437f52ff0118674b5c11a75ed649ecd092cd7766b12e2d86cdeef686958248",
      "d7f6380cbb5a070dbd394458733f0d4482c251e712f03361e863450c7599d1aa",
      "f2bc2128f1e5ab40eb1ee85b86da64a17a1c1b422114be8d6d84500ab4e13745"
    ],
    "script": "fffe0b",
    "mask": "1f67ee154a83da74e19314cbd048afd9a76e542aa2367bda37d7d1c9e974ea98",
    "lock": "0000000000000000000000000000000000000000000000000000000000000000"
  }
}

Submit Transaction

POST /transaction

Param:

{
  "version": 1,
  "asset": "b9f49cf777dc4d03bc54cd1367eebca319f8603ea1ce18910d09e2c540c630d8",
  "inputs": [
    {
      "hash": "887dfc1ed552a9cde3d205a08c0060c91f3bf627f056e561bdc604e97c47ae2f",
      "index": 30
    }
  ],
  "outputs": [
    {
      "type": 0,
      "amount": "138632.64967484",
      "keys": [
        "0c2c93a3717d34093fa58da832cac66ed36bfa79ec170f8a43dbabd5f4e6d59f"
      ],
      "script": "fffe01",
      "mask": "9088d8db185e0c607fed26c0f476d70705a50e6b8fbcc3833bb9cfd44462b961"
    },
    {
      "type": 0,
      "amount": "9999841188.79874816",
      "keys": [
        "f41e6016dcfac0837d772dcd63655580a9287289a6b7e04d4d743391b03b90ce"
      ],
      "script": "fffe01",
      "mask": "d2366656828561b531fc608d52676cb0aa740d88a5f34507df8873ddf49d30ea"
    }
  ],
  "extra": "89891a66af223f2795a9e774acfeaf40",
  "signatures": [["xxxxx"]]
}

Response:

{
  "code": 0,
  "data": {
    "tx_hash": "2d259a9cbe49eccd7878112e291e378fee7c08af0b443c598b1fbc091d7345fc"
  }
}

Documentation

Overview

Copyright © 2020 NAME HERE <EMAIL ADDRESS>

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Directories

Path Synopsis
handler
api

Jump to

Keyboard shortcuts

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