9cscan backend is built on the aws serverless architecture.
[APIGateway] -> [Lambda] -> [Dynamodb]
Provides a rest API that can inquire blocks and transactions.
[EventBridge] -> [StepFunction] -> [Lambda] -> [Dynamodb]
Synchronize the Nine Chronicles chain data to dynamodb.
[DynamoStream] -> [Lambda] -> [APIGateway]
When a new block is created, it is broadcast through WebSocket.
- Manually create a new IAM policy using
/bootstrap/iam/9cscan-policy.json
https://console.aws.amazon.com/iamv2/home#/policies - Manually create a new IAM role using
/bootstrap/iam/9cscan-role-trust.json
https://console.aws.amazon.com/iamv2/home#/roles - Manually create a new IAM user with the policy you created.
git clone https://github.com/planetarium/9cscan-cloud
cd 9cscan-cloud
npm install
{
// Required.
"region": "ap-northeast-2",
// Required. AccessKey of user you created (1.3)
"credentials": {
"accessKeyId": "",
"secretAccessKey": ""
},
// Required. Arn of role you created (1.2)
"iamRoleArn": "",
// Optional. to fetch WNCG price
"coinMarketCapKeys": {
"alias": "key"
},
//Required. Nine Chronicles graphql endpoints
"graphqlEndpoints": [
"http://your-host1/graphql",
"http://your-host2/graphql"
],
//Required.
"namespace": "prod",
//Required.
"s3WebBucketName": "9cscan-bucket"
}
npm run create-s3
------------------------------
SUCCESS : https://your-s3-endpoint/index.html
Before proceeding, make sure that the endpoint is working.
npm run create-db
------------------------------
Dynamodb : create table Prod.Account
SUCCESS : Prod.Account : arn:aws:dynamodb
Dynamodb : create table Prod.AccountTransaction
SUCCESS : Prod.AccountTransaction : arn:aws:dynamodb
Dynamodb : create table Prod.Action
SUCCESS : Prod.Action : arn:aws:dynamodb
Dynamodb : create table Prod.Block
SUCCESS : Prod.Block : arn:aws:dynamodb
Dynamodb : create table Prod.Cache
SUCCESS : Prod.Cache : arn:aws:dynamodb
Dynamodb : create table Prod.LatestBlocks
SUCCESS : Prod.LatestBlocks : arn:aws:dynamodb
Dynamodb : create table Prod.Transaction
SUCCESS : Prod.Transaction : arn:aws:dynamodb
Dynamodb : create table Prod.WebsocketConnection
SUCCESS : Prod.WebsocketConnection : arn:aws:dynamodb
npm run create-api
npm run create-sync
npm run create-ws
npm run deploy-api
npm run deploy-sync
npm run deploy-ws
npm run check-api
...
GET /blocks api response
...
npm run check-ws
...
Subscribe new block event
...
npm run check-s3
...
Get index.html
...
For the web client, use the following project:
https://github.com/planetarium/9cscan.com
Apache 2.0