Document has steps to configure OpenST Platform for development and test environments. For production environment, following steps are not recommended to avoid single point failures and scalability issues caused because of single machine.
You can test platform as standalone system or with Platform RESTful APIs. We have published this document for both kind of setups.
- Install Node version >= 7
- Install GETH version >= 1.7.2
- Install DynamoDB at location ~/dynamodb_local_latest/ and start the DynamoDB process using following command.
java -Djava.library.path=~/dynamodb_local_latest/DynamoDBLocal_lib/ -jar ~/dynamodb_local_latest/DynamoDBLocal.jar -sharedDb -dbPath ~/openst-setup/logs/
- Checkout platform code from repository
> git clone [email protected]:OpenSTFoundation/openst-platform.git
> cd openst-platform
> export OPENST_PLATFORM_PATH=$(pwd)
> echo "export OPENST_PLATFORM_PATH=$(pwd)" >> ~/.bash_profile
- Checkout RESTful APIs code from repository
> git clone [email protected]:OpenSTFoundation/openst-platform-apis.git
> cd openst-platform-apis
> export OPENST_PLATFORM_PATH=$(pwd)/node_modules/@openstfoundation/openst-platform
> echo "export OPENST_PLATFORM_PATH=$(pwd)/node_modules/@openstfoundation/openst-platform" >> ~/.bash_profile
- Install all required node modules
> npm install
- Start the openST platform setup
> node $OPENST_PLATFORM_PATH/tools/setup/index.js
Setup will create "openst-setup" folder in your HOME folder with following folders and files:
- openst-geth-value - Acts as ethereum MainNet for development/test environment using POW consensus algorithm.
- openst-geth-utility - Acts as openST side chain network for development/test environment using POA consensus algorithm.
- bin - Contain multiple executables for ethereum chains and platform services
- logs - Contain logs generated by executables in bin folder
- openst_platform_config.json - This JSON file has the config strategies.
> ls -alt $HOME/openst-setup/
(Optional) Configure Cache and Notification layers in setup
The default Platform setup is done with "in-process" caching and EventEmitter notifications. To use different caching and notifications implementation, edit $HOME/openst-setup/openst_platform_config.json file
> cat $HOME/openst-setup/openst_platform_config.json
- Start all platform services in background
> node $OPENST_PLATFORM_PATH/tools/setup/start_services.js ~/openst-setup/openst_platform_config.json
Important Note: Wait until all service are up and running. A success message will be displayed when everything is good to go. Let this script be running while branded tokens are registered and minted.
Note: Script also monitor these services and alert if any required service terminates.
- Optional steps on separate Terminals
- Listen notifications published from platform over RabbitMQ
> export OST_RMQ_SUPPORT='1' # Possible values are - '0' (disable), '1' (enable)
> export OST_RMQ_HOST='127.0.0.1'
> export OST_RMQ_PORT='5672'
> export OST_RMQ_USERNAME='guest' # Default RabbitMQ user name
> export OST_RMQ_PASSWORD='guest' # Default RabbitMQ password
> export OST_RMQ_HEARTBEATS='30'
> node $OPENST_PLATFORM_PATH/executables/notification_subscribe.js
- All logs created by different services are present in logs folder
> ls -alt $HOME/openst-setup/logs/
[x] On Terminal 2 - Once all required services are up and running, let's onboard our first branded token
- Name - branded token name (example: "ACME Coin")
- Symbol - branded token symbol (example: "ACME")
- Conversion Factor - branded token to OST conversion factor, 1 OST = x BT (example: 10).
- This is a number and has a precision of 5.
- This cannot be 0
- Valid examples:
1.0
,0.222
,.3
,1000
,15.001
- Invalid examples:
2.002222
,0
,xyz
- config strategy file path
> node $OPENST_PLATFORM_PATH/tools/setup/branded_token/register.js "ACME Coin" "ACME" 10 ~/openst-setup/openst_platform_config.json
NOTE: Upon successful registration, branded token details will be published in the branded token configuration file.
> cat $HOME/openst-setup/branded_tokens.json
{
"0x9b8f63ed597ca654262e21647d59f5ef495d173909d7816982d367b85f5ebc76": {
"Name": "ACME Coin",
"Symbol": "ACME",
"ConversionFactor": 10,
"Reserve": "0xEB05083DE29860b912151d93DB24C55b7beB6936", // Branded Token owner address on utility chain
"ReservePassphrase": "acmeOnopenST",
"UUID": "0x9b8f63ed597ca654262e21647d59f5ef495d173909d7816982d367b85f5ebc76",
"ERC20": "0x3B662406CCab34fd2Ce81Bf7154987DDCE82F6EF" // Branded Token EIP20 contract address
}
}
- Mint branded tokens and get ST' (gas) on utility chain by staking OST - Minting requires 2 input arguments:
- Symbol - branded token symbol (example: "ACME")
- Amount - The OST amount in Weis to stake, where 1 OST = (1 X 10^18) OST Wei (example: 500 OST = 500000000000000000000 OST Wei)
> node $OPENST_PLATFORM_PATH/tools/setup/branded_token/mint.js "ACME" 500000000000000000000 ~/openst-setup/openst_platform_config.json
NOTE: The above mint, actually does 2 different stakes. 90% of the total OST staked are staked for minting Branded Tokens. And 10% of the total OST staked are staked for minting OST Prime.
Example: For 500 OST, reserve address will get:
- 4500 ACME tokens ((90% of 500 staked OST) * (10 as conversion factor))
- 50 ST' ((10% of 500 staked OST) * (1 as conversion factor))
[x] Back on Terminal 1 - Stop start_services.js script, if you don't want to register and mint more branded tokens on utility chain or don't want to run platform RESTful apis.
For complete documentation on usage of OpenST Platform services, please refer Developer Guide.