Skip to content

Commit a993384

Browse files
author
pllearns
committed
docs: beautify markdown
1 parent 72f6384 commit a993384

File tree

2 files changed

+72
-76
lines changed

2 files changed

+72
-76
lines changed

.remarkrc

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
3+
}

README.md

+69-76
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@
44

55
# dAche
66

7-
[![Known Vulnerabilities](https://snyk.io/test/github/XYOracleNetwork/sdk-dache-nodejs/badge.svg)](https://snyk.io/test/github/XYOracleNetwork/sdk-dache-nodejs) [![Codacy Badge](https://api.codacy.com/project/badge/Grade/1f31c7fa87694b8eab91a2d71f74b697)](https://www.codacy.com/app/arietrouw/sdk-dache-nodejs?utm_source=github.com&utm_medium=referral&utm_content=XYOracleNetwork/sdk-dache-nodejs&utm_campaign=Badge_Grade) [![Maintainability](https://api.codeclimate.com/v1/badges/f3dd4f4d35e1bd9eeabc/maintainability)](https://codeclimate.com/github/XYOracleNetwork/sdk-dache-nodejs/maintainability) [![BCH compliance](https://bettercodehub.com/edge/badge/XYOracleNetwork/sdk-dache-nodejs?branch=master)](https://bettercodehub.com/)
7+
[![Known Vulnerabilities](https://snyk.io/test/github/XYOracleNetwork/sdk-dache-nodejs/badge.svg)](https://snyk.io/test/github/XYOracleNetwork/sdk-dache-nodejs) [![Codacy Badge](https://api.codacy.com/project/badge/Grade/1f31c7fa87694b8eab91a2d71f74b697)](https://www.codacy.com/app/arietrouw/sdk-dache-nodejs?utm_source=github.com&utm_medium=referral&utm_content=XYOracleNetwork/sdk-dache-nodejs&utm_campaign=Badge_Grade) [![Maintainability](https://api.codeclimate.com/v1/badges/f3dd4f4d35e1bd9eeabc/maintainability)](https://codeclimate.com/github/XYOracleNetwork/sdk-dache-nodejs/maintainability) [![BCH compliance](https://bettercodehub.com/edge/badge/XYOracleNetwork/sdk-dache-nodejs?branch=master)](https://bettercodehub.com/)
88

99
An ethereum smart contract event cache. Query your smart contract events in ways that you can't do directly on the blockchain. A helpful development tool or a helpful addition to your production Dapp.
1010

1111
There are three components that dAche uses to track events:
1212

13-
- __Rebase__ starts from the block the contract was created and imports events from then until the block that the dAche was started at. This is disabled by default since the included contract has a lot of events !
14-
- __Watch__ listens live for events on the contracts and immediately pulls them in
15-
- __Scan__ runs at a defined offset from the newest block on chain, and re-imports events from this range. This is to compensate for any missed live events, which can happen.
13+
- **Rebase** starts from the block the contract was created and imports events from then until the block that the dAche was started at. This is disabled by default since the included contract has a lot of events !
14+
- **Watch** listens live for events on the contracts and immediately pulls them in
15+
- **Scan** runs at a defined offset from the newest block on chain, and re-imports events from this range. This is to compensate for any missed live events, which can happen.
1616

1717
## Setup
1818

@@ -21,64 +21,60 @@ First copy `config/default.example.json` and rename to `default.json`.
2121
By default, dAche will run with an in-memory database (NeDB) to get you up and running quick.
2222

2323
Postgres is also supported, so if you prefer that fill out the storage section of the config file with your database info:
24-
```
25-
"storage": {
26-
"type": "postgres",
27-
"database": "mydb",
28-
"host": "mydb.db.com",
29-
"password": "password",
30-
"user": "admin",
31-
"port": 5432
32-
}
33-
```
24+
25+
"storage": {
26+
"type": "postgres",
27+
"database": "mydb",
28+
"host": "mydb.db.com",
29+
"password": "password",
30+
"user": "admin",
31+
"port": 5432
32+
}
3433

3534
To start dAche, `npm install` then `npm start`.
3635

3736
## Example 1: Querying CryptoKittiesCore
3837

3938
There is a simple GraphQL layer for the dAche API implemented.
4039

41-
Visit http://localhost:4000/graphql to view the built-in GrapgQL query interface.
40+
Visit <http://localhost:4000/graphql> to view the built-in GrapgQL query interface.
4241

4342
To see the latest events (ordered by newest blocks by default (order: -1):
44-
```
45-
{
46-
events {
47-
items {
48-
contractName
49-
eventName
50-
blockNumber
51-
returnValues
43+
44+
{
45+
events {
46+
items {
47+
contractName
48+
eventName
49+
blockNumber
50+
returnValues
51+
}
52+
}
5253
}
53-
}
54-
}
55-
```
5654

5755
We have implemented example queries to show how you can query the events in a way you can't directly on the blockchain.
5856
To query all events by a given return value key/value:
59-
```
60-
{
61-
events (
62-
returnValuesKey: "kittyId",
63-
returnValuesValue: "5436") {
64-
items {
65-
contractName
66-
eventName
67-
blockNumber
68-
returnValues
57+
58+
{
59+
events (
60+
returnValuesKey: "kittyId",
61+
returnValuesValue: "5436") {
62+
items {
63+
contractName
64+
eventName
65+
blockNumber
66+
returnValues
67+
}
68+
}
6969
}
70-
}
71-
}
72-
```
7370

7471
## Example 2: Generating a token holder balances report
7572

7673
This is an example of a non-grapql use of the Dache. This is a GET endpoint that will return all current token holders of a token contract (a csv of address, balance). We have included the XYO Token contract as an example.
7774

7875
Stop the dAche. Update the contractSource.contracts, replace CryptoKittiesCore with XYO. Change rebase.enabled to true. Start the dAche.
7976

80-
Visit http://localhost:4000/balances/XYO and
81-
77+
Visit <http://localhost:4000/balances/XYO> and
8278

8379
## Historic Events (Rebase)
8480

@@ -91,46 +87,44 @@ Would not recommend enabling this for the CryptoKittiesCore contract unless you
9187
## Other options
9288

9389
Options for `ethereum.network`:
94-
- mainnet
95-
- ropsten
96-
- rinkeby
97-
- kovan
90+
91+
- mainnet
92+
- ropsten
93+
- rinkeby
94+
- kovan
9895

9996
To us IPFS to load contracts, update the config to have the following entries:
100-
```
101-
"contractSource": {
102-
"type": "ipfs",
103-
"directoryHash": "QmWA8zB1zkEMGmKnD8PNHrJuQPW5hfV5NrYjYMvB6jB1Ac",
104-
"host": "ipfs.xyo.network",
105-
"protocol": "https",
106-
"port": 5002
107-
}
108-
```
97+
98+
"contractSource": {
99+
"type": "ipfs",
100+
"directoryHash": "QmWA8zB1zkEMGmKnD8PNHrJuQPW5hfV5NrYjYMvB6jB1Ac",
101+
"host": "ipfs.xyo.network",
102+
"protocol": "https",
103+
"port": 5002
104+
}
109105

110106
To use S3 to load contracts instead of a local directory, update the config to have the following entries:
111-
```
112-
"aws": {
113-
"accessKeyId": "123",
114-
"secretAccessKey": "456",
115-
"region": "us-east-1"
116-
},
117-
"contractSource": {
118-
"type": "s3",
119-
"bucketName": "mybucket",
120-
"keyPrefix": "abi/mainnet/"
121-
}
122-
```
107+
108+
"aws": {
109+
"accessKeyId": "123",
110+
"secretAccessKey": "456",
111+
"region": "us-east-1"
112+
},
113+
"contractSource": {
114+
"type": "s3",
115+
"bucketName": "mybucket",
116+
"keyPrefix": "abi/mainnet/"
117+
}
123118

124119
To only load specific contract(s) from a source, include the "contracts" key as noted below
125-
```
126-
"contractSource": {
127-
"type": "local",
128-
"directory": "./examples/contracts",
129-
"contracts": [
130-
"CryptoKittiesCore"
131-
]
132-
}
133-
```
120+
121+
"contractSource": {
122+
"type": "local",
123+
"directory": "./examples/contracts",
124+
"contracts": [
125+
"CryptoKittiesCore"
126+
]
127+
}
134128

135129
For the Scan component, you can adjust `sync.blockScanOffset`. This is how many blocks you want to wait before reimporting events that were picked up live.
136130

@@ -141,4 +135,3 @@ See the [LICENSE.md](LICENSE) file for license details.
141135
## Credits
142136

143137
Made with 🔥and ❄️ by [XY - The Persistent Company](https://www.xy.company)
144-

0 commit comments

Comments
 (0)