Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

FAT Golang Reference Implementation & Daemon

License

NotificationsYou must be signed in to change notification settings

Factom-Asset-Tokens/fatd

Repository files navigation

This repo contains the Golang reference implementation of the Factom AssetTokens protocol. This repo provides two executables for interacting with FATchains, as well as several Golang packages for use by external programs.

fatd - Factom Asset Token Daemon - Alpha

A daemon written in Golang that discovers new Factom Asset Tokens chains andmaintains their current state. The daemon provides a JSON-RPC 2.0 API foraccessing data about token chains.

fat-cli

A CLI for creating new FAT chains, as well as exploring and making transactionson existing FAT chains. See the output fromfat-cli --help for moreinformation.

Development Status

This implementation is now at a v1.0 release, which means that the public APIs,both Golang and the JSON-RPC endpoint are version locked. This also means thatwe believe the code to be stable and secure. That being said, the FAT systemand really the entire blockchain industry is experimental.

Please help us improve the code and the protocol by trying to break things andreporting bugs! Thank you!

Binaries

Pre-compiled binaries for Linux, Windows, and Mac x86_64 systems can be foundon thereleases page.However, building from source is very easy on most platforms.

Install with Docker 🐳

Build the Docker image:

$ docker build -t fatd github.com/Factom-Asset-Tokens/fatd

Create a volume for the fatd database:

$ docker volume create fatd_db

Run fatd:

$ docker run -d --name=fatd --network=host -v"fatd_db:/fatd.db" fatd [fatd options]

Building From Source

Build Dependencies

This project uses SQLite3 which usesCGo tocompile and statically link the SQLite3 C libraries to thefatd Golangbinary. CGo requires that GCC be available on your system.

The following dependencies are required to buildfatd andfat-cli.

  • Golang 1.13 or later. The latest official release ofGolang is always recommended.
  • GNU GCC is used byCGo to link to the SQLite3 sharedlibraries.
  • Git is used to clone the project and is used bygo build to pull some dependencies.
  • GNU Bash is used by a small scriptwhich determines a build version number.
  • GNU Make is used to execute buildcommands.

How To Build

Ensure that Go Modules are enabled by cloning this projectoutside of yourGOPATH.

$ git clone https://github.com/Factom-Asset-Tokens/fatd.git$cd fatd$ make

You should now see thefatd andfat-cli binaries for your platform in thecurrent directory.

You can also build binaries for all platforms (Linux, Windows, Mac):

$ make distribution

Installing

You can install and run thefatd andfat-cli binaries from anywhere, so youmay select where you wish to install these on your system.

However, be aware thatfatd will look for a directory namedfatd.db in thecurrent working directory and will create it if it does not exist. So if youstartfatd from a new location then you will likely want to point it to usean existing database using the-dbpath flag.

CLI completion

If you are using Bash or Zsh with completion you can install CLI completion forfatd andfat-cli using the-installcompletion flag on each command.

$ fatd -installcompletionInstall completion for fatd? yInstalling...Done!$ fat-cli --installcompletionInstall completion for fat-cli? yInstalling...Done!

This only adds lines to your.bash_profile or Zsh equivalent. So you mustrestart your shell or source your.bash_profile for the completion to takeeffect.

This only needs to be performed once and does not need to be repeated againwhenfatd orfat-cli is updated.

Getting started

The Daemon needs a connection tofactomd's API. This defaults tohttp://localhost:8088 and can be specified with-s.

Start the daemon from the command line:

INFO Fatd Version: v0.6.0.r110.g73bdb76            pkg=mainINFO Loading chain databases from /home/aslevy/.fatd/mainnet/...  pkg=engineINFO State engine started.                         pkg=mainINFO Listening on :8078...                         pkg=srvINFO JSON RPC API server started.                  pkg=mainINFO Factom Asset Token Daemon started.            pkg=mainINFO Searching for new FAT chains from block 163181 to 215642...  pkg=engineINFO Tracking new FAT chain: b54c4310530dc4dd361101644fa55cb10aec561e7874a7b786ea3b66f2c6fdfb  pkg=engineINFO Syncing...                                    chain=b54c4310530dc4dd361101644fa55cb10aec561e7874a7b786ea3b66f2c6fdfbINFO Synced.                                       chain=b54c4310530dc4dd361101644fa55cb10aec561e7874a7b786ea3b66f2c6fdfb

At this pointfatd has synced the first ever created FAT chain on mainnet,which is for testing purposes. It is continuing to scan for all valid FATchains so it can track them.

If you know the chain id of a FAT chain you are interested in, you can fastsync it by using the-whitelist flag.

The daemon can be stopped and restarted and syncing will resume from the latestpoint. By default the database directory is~/.fatd/. It can be specifiedwith-dbdir.

Once the JSON RPC API is started,fat-cli can be used to query about syncedchains, transactions and balances.

For a complete an up-to-date list of flags & options please seefatd -h andfat-cli -h.

Create a chain, make transactions

Interact with the FAT daemon RPC from the command line

Token Initialization & Transaction Walk Through

Defaulthttp://localhost:8078/v1

Contributing

SeeCONTRIBUTING.md


[8]ページ先頭

©2009-2025 Movatter.jp