- Node.js 8.9 or later
- npm 5.6.0 or later
-
Install dependencies
npm install
-
Run smart contract (tendermint ABCI app) server in
smart-contractrepository and wait forCommit Commit
to show in an output before starting
apiprocess. -
Add development keys to the system (for development mode only)
TENDERMINT_IP=$IP \ TENDERMINT_PORT=$PORT \ npm run initDevKey
-
Run a server
ROLE=$ROLE \ npm start
Environment variable options
ROLE: Can beidp,rp, orasTENDERMINT_IP: IP Address to contact tendermint RPC [Default:localhost]TENDERMINT_PORT: Port to contact tendermint RPC [Default:45000for IDP,45001for RP, and45002for AS]MQ_CONTACT_IP: An IP address where this NDID node message queue can be contacted [Required]MQ_BINDING_PORT: A port to bind message queue [Default:5555]SERVER_PORT: API server port [Default:8080]AS_ID: AS ID for register service (AS only)PRIVATE_KEY_PATH: Path to private key (if call back to create signature is not set) [Default: using pre-generated development key]NODE_ID: Node ID. Only when there are more than one node per role in the system. This ID tie to public key, in dev mode we haverp1,rp2,rp3,idp1,idp2,idp3,as1,as2,as3
Note
- Run
npm run delete-local-db-cacheto delete local DB used for caching. Local DB directory name isdb-api-following by node ID (env:NODE_ID) set on server start (e.g.db-api-idp1when node ID is set toidp1).
Examples
-
Run a server as an IDP
ROLE=idp \ MQ_CONTACT_IP=192.168.1.1 \ MQ_BINDING_PORT=5555 \ ASSOC_USERS=users.json \ npm start
-
Run a server as a RP
ROLE=rp \ MQ_CONTACT_IP=192.168.1.1 \ MQ_BINDING_PORT=5555 \ npm start
-
Run a server as a AS
ROLE=as \ MQ_CONTACT_IP=192.168.1.1 \ MQ_BINDING_PORT=5555 \ AS_ID=AS1 \ npm start
Don't forget to
- Set
SERVER_PORTwhen running on the same machine to avoid port collision. - Set
TENDERMINT_IPand/orTENDERMINT_PORTwhen runningsmart-contract/tenderminton another machine. - Set
NODE_IDwhen there are more than one node per role in the system.