4

I am setting up a private stellar network in my local MAC environment. It does not connect to testnet or public stellar networks.

Horizon server returns status code 404 for GET /accounts/{id}/payments

Horizon server returns status code 200 for GET /accounts/{account} with links balances, signers etc. It means account is active and working.

Using the Java SDK I am able to create accounts, custom asset, trust line, transfer funds between accounts

Below are the steps followed

  1. Build stellar-core locally with source code from GIT repository
  2. Changed the configuration to run as standalone, DB configuration, Quorum set as self etc.
  3. Initialised DB and Stellar is running stellar-core --newdb, stellar-core --forcescp, stellar-core
  4. Configured the horizon server horizon-v0.11.1-darwin-amd64

Using stellar_sdk.jar file

  1. Using Root Account (available during stellar-core startup). Created Issuing Account and Distribution Account. Used CreateAccountOperation to create the account. Check in stellar-code DB and can see the accounts created with amount.
  2. Invoked server.accounts().account() API to check if the account data is being returned
  3. Creates new asset and created as trust for the new asset using ChangeTrustOperation. Checked in DB can see the trust line between the issuing account and distribution account
  4. Transferred funds from issuing account to distribution account
  5. Invoke SetOptionsOperation to set the HomeDomain - Only
  6. Created a new account as a receiving account. Build the trust line with Issuing Account custom asset
  7. Transfer funds from distribution account to receiving account
  8. Invoke server.accounts().account() API for receiving account and checked funds are available

Now need to setup bridge server to start receiving callbacks. It fails when receiving_account_id is configured. Bridge server internally invokes Horizon server api GET /accounts/{id}/payments with streaming=true and it receives 404 and goes into infinite loop. Tried using postman tool to invoke same API getting 404 response

{ "type": "https://stellar.org/horizon-errors/not_found", "title": "Resource Missing", "status": 404, "detail": "The resource at the url requested was not found. This is usually occurs for one of two reasons: The url requested is not valid, or no data in our database could be found with the parameters provided.", "instance": "Harmits-MBP.hsd1.ca.comcast.net/bjE5pxSCGV-000009" }

Checked Horizon server DB do not find any entries in any of the history tables. Only entries are there in gorp_migrations table. I can see entries in stellar-core DB in txhistory table.

Note:

  1. While creating the custom asset I have NOT performed Manage Offer step is it necessary? I need to have my issuing account more transactions
  2. I see following log in stellar-core

2018-03-08T15:29:06.987 GAOQY [Work DEBUG] resetting prepare-snapshot

2018-03-08T15:29:07.000 GAOQY [Work DEBUG] work prepare-snapshot : WORK_FAILURE_RETRY -> WORK_PENDING

2018-03-08T15:29:07.000 GAOQY [Work DEBUG] advancing prepare-snapshot

2018-03-08T15:29:07.000 GAOQY [Work DEBUG] all 0 children of prepare-snapshot successful, scheduling run

2018-03-08T15:29:07.000 GAOQY [Work DEBUG] scheduling run of prepare-snapshot

2018-03-08T15:29:07.000 GAOQY [Work DEBUG] starting prepare-snapshot

2018-03-08T15:29:07.000 GAOQY [Work DEBUG] running prepare-snapshot

2018-03-08T15:29:07.000 GAOQY [Work DEBUG] work prepare-snapshot : WORK_PENDING -> WORK_RUNNING

2018-03-08T15:29:07.000 GAOQY [Work DEBUG] scheduling completion of prepare-snapshot

2018-03-08T15:29:07.000 GAOQY [Work DEBUG] completed prepare-snapshot

2018-03-08T15:29:07.000 GAOQY [Work DEBUG] work prepare-snapshot : WORK_RUNNING -> WORK_FAILURE_RETRY

2018-03-08T15:29:07.000 GAOQY [Work WARNING] Scheduling retry #14/4294967295 in 3023 sec, for prepare-snapshot

Can someone please help me identify why horizon server will return 404 for GET /accounts/{id}/payments. Am I missing any step?

0

There are many possible reasons why this is happening:

  • Your Horizon instance is not ingesting. To start ingesting core database you have to start it with --ingest=true parameter.
  • If your Horizon is ingesting data maybe it has not ingested ledger where payment from/to your account occurred. By default it starts ingesting data from the latest ledger in core database.

Please read Horizon Admin Guide for more information about running Horizon.

  • Thanks for for the help. I had not set ingest flag. It is working now. – Harmit Mar 12 '18 at 17:01
  • 1
    You should probably also mention that just doing --ingest-true is not enough. It will start ingesting at the ledger stellar-core is currently processing. To ingest historical data we need to also run horizon db backfill NUM_LEDGERS. Maybe there's an easier way to automatically do this but this seems to be working fine for me. – marcinx Nov 14 '18 at 9:27
1

Had the same problem but it seems I figured it out. If you want the full history available on your horizon you need to do the following.

Run your stellar-core with CATCHUP_COMPLETE=true. On your horizon side you need to manually tell it to ingest historical ledgers. Just starting horizon with --ingest=true is not enough as it will only ingest ledgers that stellar-core currently processes. The steps to manually ingest history are as follows.

  1. horizon db init initialized db schema
  2. horizon db backfill NUM_LEDGERS set this slightly higher than the current ledger on stellar-core. This way it should back fill all the way to the beginning of history.
  3. horizon --ingest=true Start your horizon with ingest=true to keep it up to date. Horizon can run while you are doing the db backfill in the background.

Maybe there is easier/better ways to do it but this is what worked for me. The docs all just mention --ingest=true but you really also need to do the db backfill for full/more complete history.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.