Factom API support
Easing the transition from Factom to Accumulate
Factom was originally deployed in 2015. Its API has been used on many projects and by many exchanges. This paper looks at the API as it exists and details what we can do to make the Accumulate API match to the extent possible. This paper outlines what we could do to bridge Factom to Accumulate. This will not be fully implemented by Activation, and we may not ever entirely implement the calls described in this document.
The API is designed for outside applications to process transactions and interact with the Factom federated servers. The listening port can be configured and runs on 8088 by default. All these APIs use JSON-RPC, a remote procedure call protocol encoded in JSON. It is a very simple protocol (and very similar to XML-RPC), defining only a handful of data types and commands.
They can be invoked in your terminal as:
curl -X POST --data-binary '{"jsonrpc": "2.0", "id": 0, "method": "METHOD_HERE", "params": {"PARAM_1":"PARAM_DATA_1"}}' -H 'content-type:text/plain;' http://localhost:8088/v2
The output will also be JSON.
We will go through the Factom API as it exists today and detail what we believe we can provide on Accumulate.
Returns Jason for entry and factoid transactions.
Accumulate has no commit transactions, so ack cannot return them Accumulate does have entries, so ack can return the entry reveals Requires a transaction date and a block date for factoid transactions
Commit-entry creates the signature for signing an entry and puts it in the wallet database keyed by the entry hash. Nothing is submitted to Accumulate at this time.
Reveal-entry creates the entry transaction and combines the entry transaction with the signature provided by commit-entry. The transaction is then submitted to Accumulate.
Returns
- Leaderheight -- DVN height /600 (10 minute cadence)
- DirectoryBlockHeight -- DVN height /600 (10 minute cadence)
- Minute -- (DVN height / 60) % 10 (minutes within a 10 minute cadence)
- Currentblockstarttime -- Timestamp of the first DVN minor block in a 10 minute cadence
- Currentminutestarttime -- First DVN minor block of the current minute in a 10 minute cadence
- Directoryblockinseconds -- 600
- Stalldetected -- returns true if Accumulate detects a stall of the node
- Faulttimeout -- returns 0
- Roundtimeout -- returns 0
- Entry-credit-balance -- The address specified must be a url to a key page. Returns the credit balance
Note that minute times are approximate. Even in Factom, minute times could stretch or compress depending upon how the various leaders synced, or if a leader had to be replaced.
- Factoid-balance -- Returns the number of ACME at a given Lite Data Account (which can be specified with the FA address). If a URL is provided instead of an address, factoid-balance can return the number of ACME at an ADI Token Account.
- Factoid-submit -- Submit a binary transaction as long as it is properly encoded and signed to Accumulate.
- Multiple-ec-balances -- all addresses must be key page urls. The call is broken up into individual calls for each key page url.
Currentheight
andlastsavedheight
are both the current height of the DVN - Multiple-fct-balances -- all addresses must be token account urls. The call is broken up into individual calls for each token account.
Currentheight
andlastsavedheight
are both the current height of the DVN - Pending-entries -- returns
0
. Accumulate does not have the commit/reveal exchange with applications and users, so writes do not pend like they do in Factom - Pending-transactions -- return any pending transactions in the signature chain for a particular transaction account. No changes to the JSON format are required. The “fees” entry on each transaction will be
0
. (This is because Accumulate does not require the inputs to be more than the outputs to pay fees but rather uses credits on the signing key page to pay fees.)
{ "jsonrpc": "2.0", "id": 0, "result": { "factomdversion": "0.5.0.0", "factomdapiversion": "3.0" } }
- Receipt -- Retrieve a receipt for a transaction hash or entry hash. This will be in Accumulate format
Reveal-chain is implemented as a Reveal-entry but creates a new Lite Data Account as well. This may be difficult to implement without a new call to create the Lite Data Account
Commit-entry creates the signature for signing an entry and puts it in the wallet database keyed by the entry hash. Nothing is submitted to Accumulate at this time. Reveal-entry creates the entry transaction and combines the entry transaction with the signature provided by commit-entry. The transaction is then submitted to Accumulate.
Sending a raw transaction allows transactions to be created off-line in secure environments and submitted to the network on a “hot” platform. Also useful for testing and debugging. Any transaction created for the Accumulate protocol should be available in raw form for disconnected construction.
Caveats include:
- No transaction block,
- directory block can be reported Directoryblockheight will be reported as the DNV minor block height / 600
- Compose-transaction Marshals the current transaction into a hex encoded string. Compose-transaction fails if the current transaction is incomplete and/or has not been signed. Returns a hex string that can be inputted into the factomd API factoid-submit to be sent to the network.
- Properties Retrieve current properties of the factom-walletd, including the wallet and wallet API versions
- Sub-fee Noop. it does nothing because we do not pay fees on Accumulate by a difference between inputs and outputs
- Tmp-transactions Lists all current working transactions in the wallet. None of these transactions have been sent
- Transactions (Retrieving) Return transactions using a range, by TxID, by Address. All Transactions are not supported
- Wallet-backup Return the wallet seed and all addresses in the wallet for backup and offline storage
Last modified 9mo ago