Ubuntu 20.04.3 LTS or higher
- Windows Subsystem for Linux IntelliJ IDEA Community 2020.3 or higher
git clone https://github.com/dashpay/explore-dash-sync.git
cd explore-dash-sync
Generate executable fat JAR ./build/deploy/explore-dash-sync-app.jar
) which
can be launched locally
./gradlew buildApp
java -jar ./build/deploy/explore-dash-sync-app.jar
This command will generate explore.dat
file in the current directory Supported arguments:
-upload
- upload data to GC Storage-dev
- load data from dev servers-quiet
- quiet mode: no notifications are pushed to Slack
Generate fat JAR ./build/deploy/explore-dash-sync-fun.jar
which can be
deployed to Google Cloud Platform (BackgroundFunction)
./gradlew buildFun
Base on Deploying Cloud Functions
gcloud functions deploy explore-dash-sync \
--runtime=java17 \
--entry-point=org.dash.mobile.explore.sync.Function \
--source=build/deploy \
--trigger-topic explore-dash-sync-trigger \
--allow-unauthenticated --memory=1024MB --timeout=300s
Can be deployed manually
from https://console.cloud.google.com/functions/list?authuser=0&project=dash-wallet-firebase CREATE FUNCTION
Function can be triggered by publishing explore-dash-sync-trigger
PubSub topic
gcloud pubsub topics publish explore-dash-sync-trigger
Or for the testnet mode:
gcloud pubsub topics publish explore-dash-sync-trigger --attribute="mode=testnet"
- src:
./src/main/proto/
- dst:
./src/main/java/
./gradlew generateProto
Google Cloud Console -> (dash-explore-sync) -> Credentials -> Download OAuth client https://console.cloud.google.com/apis/credentials?project=dash-explore-sync
save file as src/main/resources/credentials.json
Suppose new columns need to be added to the explore database.
- Use an SQLite DB Browser to edit the
merchant
oratm
tables insrc/main/resources/explore-empty.db
- Add new columns as necessary
- Add code in
MerchantData
orAtmData
to support those new columns - Depending on the data source, code must be added the
convert
methods - Within
src/main/resources/explore-empty.db
edit theroom_master_table
table value foridentity_hash
must be updated to match that of the schema generated by Room in Dash Wallet{ "formatVersion": 1, "database": { "version": 2, "identityHash": "34049b02193e63ef6d5042b150f355e6", "entities": [ ] }
- Within
src/main/resources/explore-empty.db
, the User Version must be increased and match the version ofExploreDatabase
@Database(entities = [ Merchant::class, MerchantFTS::class, Atm::class, AtmFTS::class ], version = 2, exportSchema = true) @TypeConverters(RoomConverters::class) abstract class ExploreDatabase : RoomDatabase() {
Example of adding new columns to MerchantData
:
data class MerchantData(
// ...
var minCardPurchase: Double? = 0.0,
var maxCardPurchase: Double? = 0.0,
// add new column variables here...
) {
companion object {
// Add a ? for each new column in this INSERT_STATEMENT constant
const val INSERT_STATEMENT = "INSERT INTO merchant values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"
// ...
const val MIN_CARD_PURCHASE_COL = 26
const val MAX_CARD_PURCHASE_COL = 27
// add new column number constance here...
}
override fun transferInto(statement: PreparedStatement): PreparedStatement {
return statement.apply {
// ...
setDouble(MIN_CARD_PURCHASE_COL, minCardPurchase ?: 0.0)
setDouble(MAX_CARD_PURCHASE_COL, maxCardPurchase ?: 0.0)
// add new statements here to set the values of the new columns
}
}
}