Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FCT anchors specification #154

Open
wants to merge 15 commits into
base: develop
Choose a base branch
from

Conversation

ilzheev
Copy link

@ilzheev ilzheev commented Oct 23, 2020

This PR adds structs and functions related to FCT anchoring (anchors from customnet into Factom mainnet).
As BTC and ETH anchoring is not compatible (logically) with FCT anchoring (i.e. mainnet is anchored into BTC and ETH, and customnet is anchored into mainnet, but not into BTC and ETH), so I created separate structs and functions for Factom Anchors.

Basically it's a copy of default Anchors structs and functions:

  1. AnchorsFactom{}
  2. AnchorFactom{}
  3. (a *AnchorsFactom) String()
  4. (a *AnchorsFactom) UnmarshalJSON()
  5. getAnchorsFactom(hash string, height int64) (*AnchorsFactom, error)
  6. GetAnchorsFactom(hash string) (*AnchorsFactom, error)
  7. GetAnchorsFactomByHeight(height int64) (*AnchorsFactom, error)

Also there is a test for getAnchorsFactom

WhoSoup and others added 15 commits October 16, 2019 11:58
* anchors support

* allow request for height 0

* anchor unit test
* add noraw option

* use noraw param

* add noraw option

* use noraw param

* remove raw data request

* remove unnecessary comment

Co-authored-by: Brian Deery <[email protected]>
* return useful results from pending transactions

* expand fblock transactions

* add support for dbheight

* capitalization, unit test, time conversion

Co-authored-by: Brian Deery <[email protected]>
Copy link
Member

@WhoSoup WhoSoup left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reference document for the functionality of this? I don't see a PR for the factomd implementation of this, so it's hard to review the functionality at this point.

func (a *AnchorsFactom) UnmarshalJSON(data []byte) error {
type tmp *AnchorsFactom // unmarshal into a new type to prevent infinite loop
// json can't unmarshal a bool into a struct, but it can recognize a null pointer
data = bytes.Replace(data, []byte("\"factom\":false"), []byte("\"factom\":null"), -1)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was a workaround in Anchors.UnmarshalJSON because the Factomd API wrongfully reports it like that and would have required a breaking API change to fix. Since this doesn't have an implemented on the factomd end yet, I see no reason to do it this way and just have the API implementation report a null.

@ilzheev
Copy link
Author

ilzheev commented Oct 26, 2020

There is no factomd implementation yet, so I agree that we should merge this PR together with factomd PR related to FCT anchors.

Is anyone willing to develop factomd functionality for this?
@WhoSoup @PaulBernier @PaulSnow

@WhoSoup
Copy link
Member

WhoSoup commented Oct 26, 2020

Is anyone willing to develop factomd functionality for this?

Is there a technical design for how the thing is supposed to work (in terms of parsing, config layout, format, etc) available?

@ilzheev
Copy link
Author

ilzheev commented Oct 26, 2020

Is anyone willing to develop factomd functionality for this?

Is there a technical design for how the thing is supposed to work (in terms of parsing, config layout, format, etc) available?

It's pretty the same as mainnet BTC anchoring.

  • The anchoring software (standalone binary) connects to both custom network and Factom Open Node
  • Chain for anchors is created on mainnet, the chainID set into anchoring software config
  • Chain for proof-of-anchors (FactomAnchorChainFCT) is created on customnet
  • Customnet factomd authority nodes add ChainID of FactomAnchorChainFCT into config and parse anchoring data from there

TL;DR;
Anchoring software (to be developed by De Facto):

  • Reads customnet dblocks and anchors them into mainnet
  • Writes proof-of-anchors into FactomAnchorChainFCT on customnet

Customet factomd:

  • Parses data from FactomAnchorChainFCT and returns it via anchors API

Testnet/customnet explorer:

  • Parses data from factomd via anchors API

--
Need to develop:

  1. specification for proof-of-anchor entries into customnet FactomAnchorChainFCT
  2. specification for anchor entries into mainnet
  3. factomd API update to support parsing FCT anchors from FactomAnchorChainFCT

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants