package
1.6.0
Repository: https://github.com/ndau/commands.git
Documentation: pkg.go.dev

# README

ndau API

This API reference is automatically generated: do not edit it. Make changes in README-template.md.

The ndau API provides an http interface to an ndau node. It is used to prevalidate and submit transactions, and to retrieve information about the ndau blockchain's system variables, price information, transactions, blocks, and accounts.


/

This service provides the ndau API, used to retrieve information about and manage the ndau blockchain and its Tendermint consensus engine.

It is organized into several sections:

  • /account returns data about specific accounts
  • /block returns information about blocks on the blockchain
  • /node provides information about node operations
  • /price returns information related to the ndau monetary system
  • /state provides dynamic system state information
  • /system rqueries or sets system variables
  • /transaction queries individual transactions on the blockchain
  • /tx provides tools to build, prevalidate, and submit transactions
  • /version returns current system version information

Each of these, in turn, has several endpoints within it.


AccountByID

GET /account/account/:address

Returns current state of an account given its address.

Will return an empty result if the account is a valid ID but not on the blockchain.

Produces: [application/json]

Writes:

        {
          "balance": 123000000,
          "validationKeys": [
            "npuba8jadtbbedhhdcad42tysymzpi5ec77vpi4exabh3unu2yem8wn4wv22kvvt24kpm3ghikst"
          ],
          "validationScript": null,
          "rewardsTarget": null,
          "incomingRewardsFrom": null,
          "delegationNode": null,
          "lock": null,
          "lastEAIUpdate": "2000-01-01T00:00:00.000000Z",
          "lastWAAUpdate": "2000-01-01T00:00:00.000000Z",
          "weightedAverageAge": "1m",
          "sequence": 0,
          "stake_rules": null,
          "costakers": null,
          "holds": null,
          "recourseSettings": {
            "period": "t0s",
            "changes_at": null,
            "next": null
          },
          "currencySeatDate": null,
          "parent": null,
          "progenitor": null
        }

AccountsFromList

POST /account/accounts

Returns current state of several accounts given a list of addresses.

Only returns data for accounts that actively exist on the blockchain.

Parameters:

NameKindDescriptionDataType
bodyBody[]string

Consumes: [application/json]

Reads:

        [
          "ndamgmmntjwhq37gi6rwpazy4fka6zgzix55x85kkhepvuue"
        ]

Produces: [application/json]

Writes:

        {
          "ndamgmmntjwhq37gi6rwpazy4fka6zgzix55x85kkhepvuue": {
            "balance": 123000000,
            "validationKeys": [
              "npuba8jadtbbedhhdcad42tysymzpi5ec77vpi4exabh3unu2yem8wn4wv22kvvt24kpm3ghikst"
            ],
            "validationScript": null,
            "rewardsTarget": null,
            "incomingRewardsFrom": null,
            "delegationNode": null,
            "lock": null,
            "lastEAIUpdate": "2000-01-01T00:00:00.000000Z",
            "lastWAAUpdate": "2000-01-01T00:00:00.000000Z",
            "weightedAverageAge": "1m",
            "sequence": 0,
            "stake_rules": null,
            "costakers": null,
            "holds": null,
            "recourseSettings": {
              "period": "t0s",
              "changes_at": null,
              "next": null
            },
            "currencySeatDate": null,
            "parent": null,
            "progenitor": null
          }
        }

AccountHistory

GET /account/history/:address

Returns the balance history of an account given its address.

The history includes the timestamp, new balance, and transaction ID of each change to the account's balance. The result is sorted chronologically.

Parameters:

NameKindDescriptionDataType
addressPathThe address of the account for which to return historystring
afterQueryThe block height after which results should start.string
limitQueryThe maximum number of items to return. Use a positive limit, or 0 for getting max results; default=0, max=100int

Produces: [application/json]

Writes:

        {
          "Items": [
            {
              "Balance": 123000000,
              "Timestamp": "2018-07-10T20:01:02Z",
              "TxHash": "L4hD20bp7w4Hi19vpn46wQ",
              "Height": 0
            }
          ],
          "Next": ""
        }

AccountList

GET /account/list

Returns a list of account IDs.

This returns a list of every account on the blockchain, sorted alphabetically. A maximum of 1000 accounts can be returned in a single request. The results are sorted by address.

Parameters:

NameKindDescriptionDataType
afterQueryThe address after which (sorted alphabetically) results should start.string
limitQueryThe maximum number of items to return. Use a positive limit, or 0 for getting max results; default=0, max=100int

Produces: [application/json]

Writes:

        {
          "NumAccounts": 1,
          "FirstIndex": 1,
          "After": "ndamgmmntjwhq37gi6rwpazy4fka6zgzix55x85kkhepvuue",
          "NextAfter": "ndamgmmntjwhq37gi6rwpazy4fka6zgzix55x85kkhepvuue",
          "Accounts": [
            "ndamgmmntjwhq37gi6rwpazy4fka6zgzix55x85kkhepvuue"
          ]
        }

AccountCurrencySeats

GET /account/currencyseats

Returns a list of ndau 'currency seats', the oldest 3000 accounts containing more than 1000 ndau.

The ndau currency seats are accounts containing more than 1000 ndau. The seniority of a currency seat is determined by how long it has been above the 1000 threshold, so this endpoint also sorts the result by age (oldest first). It does not return detailed account information.

Parameters:

NameKindDescriptionDataType
limitQueryThe max number of items to return (default=3000)int

Produces: [application/json]

Writes:

        {
          "NumAccounts": 1,
          "FirstIndex": 1,
          "After": "ndamgmmntjwhq37gi6rwpazy4fka6zgzix55x85kkhepvuue",
          "NextAfter": "ndamgmmntjwhq37gi6rwpazy4fka6zgzix55x85kkhepvuue",
          "Accounts": [
            "ndamgmmntjwhq37gi6rwpazy4fka6zgzix55x85kkhepvuue"
          ]
        }

DEPRECATED:AccountEAIRate

POST /account/eai/rate

This call is deprecated -- please use /system/eai/rate.

Consumes: [application/json]

Reads:

        null

Produces: [application/json]

Writes:

        null

AccountVotes

GET /account/votes/:address/:date

Returns the number of votes to which an account is entitled on a valid ndau DAO election date

Parameters:

NameKindDescriptionDataType
addressPathThe address of the account for which to return votesstring
DATEPathTimestamp (ISO 3339) of DAO vote (only YYYY-MM-DD is used).string

Produces: [application/json]

Writes:

        {
          "balance": 123000000,
          "validationKeys": [
            "npuba8jadtbbedhhdcad42tysymzpi5ec77vpi4exabh3unu2yem8wn4wv22kvvt24kpm3ghikst"
          ],
          "validationScript": null,
          "rewardsTarget": null,
          "incomingRewardsFrom": null,
          "delegationNode": null,
          "lock": null,
          "lastEAIUpdate": "2000-01-01T00:00:00.000000Z",
          "lastWAAUpdate": "2000-01-01T00:00:00.000000Z",
          "weightedAverageAge": "1m",
          "sequence": 0,
          "stake_rules": null,
          "costakers": null,
          "holds": null,
          "recourseSettings": {
            "period": "t0s",
            "changes_at": null,
            "next": null
          },
          "currencySeatDate": null,
          "parent": null,
          "progenitor": null
        }

BlockBefore

GET /block/before/:height

Returns a (possibly filtered) sequence of block metadata for blocks on or before a given height.

Parameters:

NameKindDescriptionDataType
heightPathBlocks greater than this height will not be returned.int
filterQuerySet to 'noempty' to exclude empty blocks.string
afterQueryThe block height after which no more results should be returned.int
limitQueryThe maximum number of items to return. Use a positive limit, or 0 for getting max results; default=0, max=100int

Produces: [application/json]

Writes:

        {
          "last_height": 12345,
          "block_metas": [
            {
              "block_id": {
                "hash": "",
                "parts": {
                  "total": 0,
                  "hash": ""
                }
              },
              "header": {
                "version": {
                  "block": 0,
                  "app": 0
                },
                "chain_id": "",
                "height": 0,
                "time": "0001-01-01T00:00:00Z",
                "num_txs": 0,
                "total_txs": 0,
                "last_block_id": {
                  "hash": "",
                  "parts": {
                    "total": 0,
                    "hash": ""
                  }
                },
                "last_commit_hash": "",
                "data_hash": "",
                "validators_hash": "",
                "next_validators_hash": "",
                "consensus_hash": "",
                "app_hash": "",
                "last_results_hash": "",
                "evidence_hash": "",
                "proposer_address": ""
              }
            }
          ]
        }

BlockCurrent

GET /block/current

Returns the most recent block in the chain

Produces: [application/json]

Writes:

        {
          "block_meta": {
            "block_id": {
              "hash": "",
              "parts": {
                "total": 0,
                "hash": ""
              }
            },
            "header": {
              "version": {
                "block": 0,
                "app": 0
              },
              "chain_id": "",
              "height": 0,
              "time": "0001-01-01T00:00:00Z",
              "num_txs": 0,
              "total_txs": 0,
              "last_block_id": {
                "hash": "",
                "parts": {
                  "total": 0,
                  "hash": ""
                }
              },
              "last_commit_hash": "",
              "data_hash": "",
              "validators_hash": "",
              "next_validators_hash": "",
              "consensus_hash": "",
              "app_hash": "",
              "last_results_hash": "",
              "evidence_hash": "",
              "proposer_address": ""
            }
          },
          "block": {
            "header": {
              "version": {
                "block": 0,
                "app": 0
              },
              "chain_id": "",
              "height": 0,
              "time": "0001-01-01T00:00:00Z",
              "num_txs": 0,
              "total_txs": 0,
              "last_block_id": {
                "hash": "",
                "parts": {
                  "total": 0,
                  "hash": ""
                }
              },
              "last_commit_hash": "",
              "data_hash": "",
              "validators_hash": "",
              "next_validators_hash": "",
              "consensus_hash": "",
              "app_hash": "",
              "last_results_hash": "",
              "evidence_hash": "",
              "proposer_address": ""
            },
            "data": {
              "txs": null
            },
            "evidence": {
              "evidence": null
            },
            "last_commit": null
          }
        }

BlockHash

GET /block/hash/:blockhash

Returns the block in the chain with the given hash.

Parameters:

NameKindDescriptionDataType
blockhashPathHex hash of the block in chain to return.string

Produces: [application/json]

Writes:

        {
          "block_meta": {
            "block_id": {
              "hash": "",
              "parts": {
                "total": 0,
                "hash": ""
              }
            },
            "header": {
              "version": {
                "block": 0,
                "app": 0
              },
              "chain_id": "",
              "height": 0,
              "time": "0001-01-01T00:00:00Z",
              "num_txs": 0,
              "total_txs": 0,
              "last_block_id": {
                "hash": "",
                "parts": {
                  "total": 0,
                  "hash": ""
                }
              },
              "last_commit_hash": "",
              "data_hash": "",
              "validators_hash": "",
              "next_validators_hash": "",
              "consensus_hash": "",
              "app_hash": "",
              "last_results_hash": "",
              "evidence_hash": "",
              "proposer_address": ""
            }
          },
          "block": {
            "header": {
              "version": {
                "block": 0,
                "app": 0
              },
              "chain_id": "",
              "height": 0,
              "time": "0001-01-01T00:00:00Z",
              "num_txs": 0,
              "total_txs": 0,
              "last_block_id": {
                "hash": "",
                "parts": {
                  "total": 0,
                  "hash": ""
                }
              },
              "last_commit_hash": "",
              "data_hash": "",
              "validators_hash": "",
              "next_validators_hash": "",
              "consensus_hash": "",
              "app_hash": "",
              "last_results_hash": "",
              "evidence_hash": "",
              "proposer_address": ""
            },
            "data": {
              "txs": null
            },
            "evidence": {
              "evidence": null
            },
            "last_commit": null
          }
        }

BlockHeight

GET /block/height/:height

Returns the block in the chain at the given height.

Parameters:

NameKindDescriptionDataType
heightPathHeight of the block in chain to return.int

Produces: [application/json]

Writes:

        {
          "block_meta": {
            "block_id": {
              "hash": "",
              "parts": {
                "total": 0,
                "hash": ""
              }
            },
            "header": {
              "version": {
                "block": 0,
                "app": 0
              },
              "chain_id": "",
              "height": 0,
              "time": "0001-01-01T00:00:00Z",
              "num_txs": 0,
              "total_txs": 0,
              "last_block_id": {
                "hash": "",
                "parts": {
                  "total": 0,
                  "hash": ""
                }
              },
              "last_commit_hash": "",
              "data_hash": "",
              "validators_hash": "",
              "next_validators_hash": "",
              "consensus_hash": "",
              "app_hash": "",
              "last_results_hash": "",
              "evidence_hash": "",
              "proposer_address": ""
            }
          },
          "block": {
            "header": {
              "version": {
                "block": 0,
                "app": 0
              },
              "chain_id": "",
              "height": 0,
              "time": "0001-01-01T00:00:00Z",
              "num_txs": 0,
              "total_txs": 0,
              "last_block_id": {
                "hash": "",
                "parts": {
                  "total": 0,
                  "hash": ""
                }
              },
              "last_commit_hash": "",
              "data_hash": "",
              "validators_hash": "",
              "next_validators_hash": "",
              "consensus_hash": "",
              "app_hash": "",
              "last_results_hash": "",
              "evidence_hash": "",
              "proposer_address": ""
            },
            "data": {
              "txs": null
            },
            "evidence": {
              "evidence": null
            },
            "last_commit": null
          }
        }

BlockRange

GET /block/range/:first/:last

Returns a sequence of block metadata starting at first and ending at last

Parameters:

NameKindDescriptionDataType
firstPathHeight at which to begin retrieval of blocks.int
lastPathHeight at which to end retrieval of blocks.int
noemptyQuerySet to nonblank value to exclude empty blocksstring

Produces: [application/json]

Writes:

        {
          "last_height": 12345,
          "block_metas": [
            {
              "block_id": {
                "hash": "",
                "parts": {
                  "total": 0,
                  "hash": ""
                }
              },
              "header": {
                "version": {
                  "block": 0,
                  "app": 0
                },
                "chain_id": "",
                "height": 0,
                "time": "0001-01-01T00:00:00Z",
                "num_txs": 0,
                "total_txs": 0,
                "last_block_id": {
                  "hash": "",
                  "parts": {
                    "total": 0,
                    "hash": ""
                  }
                },
                "last_commit_hash": "",
                "data_hash": "",
                "validators_hash": "",
                "next_validators_hash": "",
                "consensus_hash": "",
                "app_hash": "",
                "last_results_hash": "",
                "evidence_hash": "",
                "proposer_address": ""
              }
            }
          ]
        }

BlockTransactions

GET /block/transactions/:height

Returns transaction hashes for a given block. These can be used to fetch data for individual transactions.

Parameters:

NameKindDescriptionDataType
heightPathHeight of the block in chain containing transactions.int

Produces: [application/json]

Writes:

        [
          "L4hD20bp7w4Hi19vpn46wQ"
        ]

BlockDateRange

GET /block/daterange/:first/:last

Returns a sequence of block metadata starting at first date and ending at last date

Parameters:

NameKindDescriptionDataType
firstPathTimestamp (ISO 3339) at which to begin (inclusive) retrieval of blocks.string
lastPathTimestamp (ISO 3339) at which to end (exclusive) retrieval of blocks.string
noemptyQuerySet to nonblank value to exclude empty blocksstring
afterQueryThe timestamp after which results should start (use the last value from the previous page).string
limitQueryThe maximum number of items to return. Use a positive limit, or 0 for getting max results; default=0, max=100int

Produces: [application/json]

Writes:

        {
          "last_height": 12345,
          "block_metas": [
            {
              "block_id": {
                "hash": "",
                "parts": {
                  "total": 0,
                  "hash": ""
                }
              },
              "header": {
                "version": {
                  "block": 0,
                  "app": 0
                },
                "chain_id": "",
                "height": 0,
                "time": "0001-01-01T00:00:00Z",
                "num_txs": 0,
                "total_txs": 0,
                "last_block_id": {
                  "hash": "",
                  "parts": {
                    "total": 0,
                    "hash": ""
                  }
                },
                "last_commit_hash": "",
                "data_hash": "",
                "validators_hash": "",
                "next_validators_hash": "",
                "consensus_hash": "",
                "app_hash": "",
                "last_results_hash": "",
                "evidence_hash": "",
                "proposer_address": ""
              }
            }
          ]
        }

NodeStatus

GET /node/status

Returns the status of the current node.

Produces: [application/json]

Writes:

        {
          "node_info": {
            "protocol_version": {
              "p2p": 0,
              "block": 0,
              "app": 0
            },
            "id": "",
            "listen_addr": "",
            "network": "",
            "version": "",
            "channels": "",
            "moniker": "",
            "other": {
              "tx_index": "",
              "rpc_address": ""
            }
          },
          "sync_info": {
            "latest_block_hash": "",
            "latest_app_hash": "",
            "latest_block_height": 0,
            "latest_block_time": "0001-01-01T00:00:00Z",
            "catching_up": false
          },
          "validator_info": {
            "address": "",
            "pub_key": null,
            "voting_power": 0
          }
        }

NodeHealth

GET /node/health

Returns the health of the current node by doing a simple test for connectivity and response.

Produces: [application/json]

Writes:

        {
          "Ndau": {
            "Status": ""
          }
        }

NodeNetInfo

GET /node/net

Returns the network information of the current node.

Produces: [application/json]

Writes:

        {
          "listening": false,
          "listeners": null,
          "n_peers": 0,
          "peers": null
        }

NodeGenesis

GET /node/genesis

Returns the genesis document of the current node.

Produces: [application/json]

Writes:

        {
          "genesis": null
        }

NodeABCIInfo

GET /node/abci

Returns info on the node's ABCI interface.

Produces: [application/json]

Writes:

        {
          "response": {}
        }

NodeConsensusState

GET /node/consensus

Returns the current Tendermint consensus state in JSON

Produces: [application/json]

Writes:

        {
          "round_state": null,
          "peers": null
        }

DEPRECATED:NodeList

GET /node/nodes

deprecated: please use /node/registerednodes

Produces: [application/json]

Writes:

        {
          "nodes": null
        }

RegisteredNodes

GET /node/registerednodes

Returns the set of registered nodes, and some information about each

Produces: [application/json]

Writes:

        {
          "ndamgmmntjwhq37gi6rwpazy4fka6zgzix55x85kkhepvuue": {
            "node": {
              "active": true,
              "distribution_script": "oACI",
              "tm_address": "6E64616D676D6D6E746A77687133376769367277",
              "public_key": "npuba8jadtbbedhhdcad42tysymzpi5ec77vpi4exabh3unu2yem8wn4wv22kvvt24kpm3ghikst"
            },
            "registration": "2018-07-10T20:01:02.000000Z"
          }
        }

NodeID

GET /node/:id

Returns a single node.

Parameters:

NameKindDescriptionDataType
idPaththe NodeID as a hex stringstring

Produces: [application/json]


PriceInfo

GET /price/current

Returns current price data for key parameters.

Returns current price information:

  • Market price
  • Target price
  • Total ndau issued from the endowment
  • Total ndau in circulation
  • Total SIB burned
  • Current SIB in effect

Produces: [application/json]

Writes:

        {
          "marketPrice": 1234000000000,
          "targetPrice": 5678000000000,
          "floorPrice": 0,
          "totalReleased": 0,
          "totalIssued": 291900000000000,
          "totalNdau": 314159300000000,
          "totalBurned": 12300000000,
          "sib": 9876543210
        }

PriceHistory

POST /price/target/history

Returns an array of data at each change point of the target price over time, sorted chronologically.

Parameters:

NameKindDescriptionDataType
bodyBodysearch.PriceQueryParams

Consumes: [application/json]

Reads:

        {
          "after": {
            "block_height": 1234
          },
          "before": {
            "timestamp": "2019-12-27T00:00:00.000000Z"
          },
          "limit": 1
        }

Produces: [application/json]

Writes:

        {
          "items": [
            {
              "price_nanocents": 2000000000000,
              "block_height": 1235,
              "timestamp": "2019-09-05T00:00:00.000000Z"
            }
          ],
          "next": ""
        }

PriceHistory

POST /price/market/history

Returns an array of data at each change point of the target price over time, sorted chronologically.

Parameters:

NameKindDescriptionDataType
bodyBodysearch.PriceQueryParams

Consumes: [application/json]

Reads:

        {
          "after": {
            "block_height": 1234
          },
          "before": {
            "timestamp": "2019-12-27T00:00:00.000000Z"
          },
          "limit": 1
        }

Produces: [application/json]

Writes:

        {
          "items": [
            {
              "price_nanocents": 2000000000000,
              "block_height": 1235,
              "timestamp": "2019-09-05T00:00:00.000000Z"
            }
          ],
          "next": ""
        }

StateDelegates

GET /state/delegates

Returns the current collection of delegate information.

Produces: [application/json]

Writes:

        ""

SystemAll

GET /system/all

Returns the names and current values of all currently-defined system variables.

Produces: [application/json]

Writes:

        ""

SystemGet

GET /system/get/:sysvars

Return the names and current values of some currently definted system variables.

Parameters:

NameKindDescriptionDataType
sysvarsPathA comma-separated list of system variables of interest.string

Produces: [application/json]

Writes:

        ""

SystemSet

POST /system/set/:sysvar

Returns a transaction which sets a system variable.

The body of the request accepts JSON and heuristically transforms it into the data format used internally on the blockchain. Do not use any sort of wrapping object. The correct structure of the object to send depends on the system variable in question.

Returns the JSON encoding of a SetSysvar transaction. It is the caller's responsibility to update this transaction with appropriate sequence and signatures and then send it at the normal endpoint (/tx/submit/setsysvar).

Parameters:

NameKindDescriptionDataType
sysvarPathThe name of the system variable to returnstring

Consumes: [application/json]

Reads:

        null

Produces: [application/json]

Writes:

        ""

SystemHistory

GET /system/history/:sysvar

Returns the value history of a system variable given its name.

The history includes the height and value of each change to the system variable. The result is sorted chronologically.

Parameters:

NameKindDescriptionDataType
sysvarPathThe name of the system variable for which to return historystring
afterQueryThe block height after which results should start.string
limitQueryThe maximum number of items to return. Use a positive limit, or 0 for getting max results; default=0, max=100int

Produces: [application/json]

Writes:

        {
          "history": [
            {
              "height": 12345,
              "value": "VmFsdWU="
            }
          ]
        }

SystemEAIRate

POST /system/eai/rate

Returns eai rates for a collection of account information.

Accepts an array of rate requests that includes an address field; this field may be any string (the account information is not checked). It returns an array of rate responses, which includes the address passed so that responses may be correctly correlated to the input.

It accepts a timestamp, which will be used to adjust WAA in the event the account is locked and has a non-nil "unlocksOn" value. If the timestamp field is omitted, the current time is used.

EAIRate in the response is an integer equal to the fractional EAI rate times 10^12.

Parameters:

NameKindDescriptionDataType
bodyBody[]routes.EAIRateRequest

Consumes: [application/json]

Reads:

        [
          {
            "address": "ndamgmmntjwhq37gi6rwpazy4fka6zgzix55x85kkhepvuue",
            "weightedAverageAge": "3m",
            "lock": {
              "noticePeriod": "6m",
              "unlocksOn": null,
              "bonus": 20000000000
            },
            "at": "2018-07-10T20:01:02.000000Z"
          }
        ]

Produces: [application/json]

Writes:

        [
          {
            "address": "ndamgmmntjwhq37gi6rwpazy4fka6zgzix55x85kkhepvuue",
            "eairate": 60000000000
          }
        ]

DEPRECATED:TransactionByHash

GET /transaction/:txhash

This call is deprecated -- please use /transaction/detail.

Produces: [application/json]

Writes:

        {
          "BlockHeight": 1234,
          "TxOffset": 3,
          "Fee": 0,
          "SIB": 0,
          "Tx": null,
          "TxBytes": null
        }

TransactionByHash

GET /transaction/detail/:txhash

Returns a transaction from the blockchain given its tx hash.

Produces: [application/json]

Writes:

        {
          "BlockHeight": 1234,
          "TxOffset": 3,
          "Fee": 0,
          "SIB": 0,
          "TxHash": "123abc34099f",
          "TxType": "Lock",
          "TxData": {
            "target": "ndamgmmntjwhq37gi6rwpazy4fka6zgzix55x85kkhepvuue",
            "period": "1m",
            "sequence": 1234,
            "signatures": null
          },
          "Timestamp": "2018-07-10T20:01:02Z"
        }

TransactionBefore

GET /transaction/before/:txhash

Returns a sequence of transaction metadata for transactions on or before a given transaction hash.

Parameters:

NameKindDescriptionDataType
txhashPathOnly transactions on or before this will be returned. Use 'start' to get the most recent page of transactions. Use a numeric block height to get transactions in and before that blockstring
typeQueryCase-insensitive transaction type name to filter by. Use multiple instances of this parameter to get results for multiple transaction types. Leave off to get transactions of any typestring
limitQueryThe maximum number of items to return. Use a positive limit, or 0 for getting max results; default=0, max=100int

Produces: [application/json]

Writes:

        {
          "Txs": [
            {
              "BlockHeight": 1234,
              "TxOffset": 3,
              "Fee": 0,
              "SIB": 0,
              "TxHash": "123abc34099f",
              "TxType": "Lock",
              "TxData": {
                "target": "ndamgmmntjwhq37gi6rwpazy4fka6zgzix55x85kkhepvuue",
                "period": "1m",
                "sequence": 1234,
                "signatures": null
              },
              "Timestamp": "2018-07-10T20:01:02Z"
            }
          ],
          "NextTxHash": "123abc34099f"
        }

TxPrevalidate

POST /tx/prevalidate/:txtype

Prevalidates a transaction (tells if it would be accepted and what the transaction fee will be.

Transactions consist of JSON for any defined transaction type (see submit).

Parameters:

NameKindDescriptionDataType
bodyBody*ndau.Lock

Consumes: [application/json]

Reads:

        {
          "target": "ndamgmmntjwhq37gi6rwpazy4fka6zgzix55x85kkhepvuue",
          "period": "1m",
          "sequence": 1234,
          "signatures": null
        }

Produces: [application/json]

Writes:

        {
          "fee_napu": 100,
          "sib_napu": 10,
          "err": "Err and ErrCode are only set if an error occurred",
          "hash": "123abc34099f",
          "msg": "only set if additional information is available",
          "code": 0
        }

TxSubmit

POST /tx/submit/:txtype

Submits a transaction.

Transactions consist of JSON for any defined transaction type. Valid transaction names and aliases are: burn, change-recourse-period, changerecourseperiod, changeschema, changevalidation, claimnodereward, commandvalidatorchange, create-child, create-child-account, createchildaccount, crediteai, crp, cvc, delegate, issue, lock, nnr, nominatenodereward, notify, record-price, recordendowmentnav, recordprice, registernode, releasefromendowment, resolvestake, rfe, set-validation, setrewardsdestination, setstakerules, setsysvar, setv, setvalidation, ssv, stake, transfer, transferandlock, unregisternode, unstake

Parameters:

NameKindDescriptionDataType
bodyBody*ndau.Lock

Consumes: [application/json]

Reads:

        {
          "target": "ndamgmmntjwhq37gi6rwpazy4fka6zgzix55x85kkhepvuue",
          "period": "1m",
          "sequence": 1234,
          "signatures": null
        }

Produces: [application/json]

Writes:

        {
          "hash": "123abc34099f",
          "msg": "only set if additional information is available",
          "code": 0
        }

Version

GET /version

Delivers version information

Produces: [application/json]

Writes:

        {
          "NdauVersion": "v1.2.3",
          "NdauSha": "23abc35",
          "Network": "mainnet"
        }

Design

This tool uses a boneful service, based on the bone router.

Configuration is provided with environment variables specifying the following

  • How much logging you want (error, warn, info, debug).
  • The protocol, host and port of the ndau node's rpc port. Required.
  • And the port to listen on.

Communication between this program and tendermint is firstly done with the tool pkg and indirectly with Tendermint's RPC client, which is based on JSON RPC.

Testing depends on a test net to be available and as such are not very pure unit tests.

Getting started

./build.sh
NDAUAPI_NDAU_RPC_URL=http://127.0.0.1:31001 ./ndauapi

Basic Usage

# get node status
curl localhost:3030/status

Testing in VSCode

Please include this in your VSCode config to run individual tests. Replace the IP and port with your ndau node's IP and Tendermint RPC port.

    "go.testEnvVars": {
        "NDAUAPI_NDAU_RPC_URL": "http://127.0.0.1:31001"
    },