Skip to content

Commit

Permalink
Add Rosetta README (#1367)
Browse files Browse the repository at this point in the history
* Adds Rosetta readme

* Update REAME.md

* move rosetta readme to its on sub-directory
  • Loading branch information
LindaOrtega authored Feb 16, 2022
1 parent 494b934 commit dc5cd93
Show file tree
Hide file tree
Showing 5 changed files with 475 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,4 @@ TAGS
*.hie
.DS_Store
.vscode/*
rosetta/logs/*
42 changes: 42 additions & 0 deletions rosetta/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Rosetta Kadena

## Testing with rosetta-cli
To validate Kadena's rosetta implementation, install [rosetta-cli](https://github.com/coinbase/rosetta-cli#install) and run one of the following commands:

1. This command validates that the Data API information in the testnet network is correct. It also ensures that the implementation does not miss any balance-changing operations.
```
rosetta-cli check:data --configuration-file rosetta-cli-conf/testnet/chain0/configTestnetChain0.json
```

2. This command validates the blockchain’s construction, signing, and broadcasting.
See `rosetta-cli-conf/testnet/chain0/testnet-chain00.ros` for an example of the types of operations supported.
_Only k:accounts transfers are currently available._
```
rosetta-cli check:construction --configuration-file rosetta-cli-conf/testnet/chain0/configTestnetChain0.json
```

3. This command validates that the Data API information in the mainnet network is correct. It also ensures that the implementation does not miss any balance-changing operations.
```
rosetta-cli check:data --configuration-file rosetta-cli-conf/mainnet/chain0/configMainnetChain0.json
```


A couple of things to note:
- The configuration files included here assume testing on chain “0”.
- To run these `rosetta-cli` commands on another chain (valid chains are chains “0” through “19”), change sub_network_identifier.network from “0” to the chain id of your choice. Chain id is expected as a string not a number.
- Replace `localhost` in the `online_url` and `offline_url` fields with the IP address of the testing node that has rosetta enabled for the network (e.g. testnet or mainnet) you’re testing.
- `testnet04` refers to tesnet, and `mainnet01` refers to mainnet.

## Funding Accounts
As part of the testing workflow of the Construction API, accounts need to be funded.

The testnet faucet for chain 1 can be found here: https://faucet.testnet.chainweb.com/

In order to fund accounts using these pre funded accounts, we suggest using https://github.com/kadena-io/kda-exchange-integration and to follow the withdrawal example.

Some clarifications on this example:
```
processWithdraw('coin', EXCHANGE_KACCOUNT, EXCHANGE_PRIVKEY, customerAddress, 10, "13").then((res) => console.log(res))
```
- `10` refers to the amount to be transferred
- `“13”` refers to the chain id where the “customerAddress” is located
52 changes: 52 additions & 0 deletions rosetta/mainnet/chain0/configMainnetChain0.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
{
"network": {
"blockchain": "kadena",
"network": "mainnet01",
"sub_network_identifier": {
"network": "0"
}
},
"online_url": "http://localhost:1848/chainweb/0.0/mainnet01/rosetta",
"data_directory": "logs/chain0",
"http_timeout": 10,
"max_retries": 5,
"retry_elapsed_time": 0,
"max_online_connections": 120,
"max_sync_concurrency": 64,
"tip_delay": 300,
"max_reorg_depth": 100,
"log_configuration": false,
"compression_disabled": false,
"memory_limit_disabled": false,
"error_stack_trace_enabled": false,
"construction": null,
"data": {
"active_reconciliation_concurrency": 16,
"inactive_reconciliation_concurrency": 4,
"inactive_reconciliation_frequency": 250,
"log_blocks": true,
"log_transactions": false,
"log_balance_changes": false,
"log_reconciliations": false,
"ignore_reconciliation_error": false,
"exempt_accounts": "",
"bootstrap_balances": "",
"interesting_accounts": "",
"reconciliation_disabled": false,
"reconciliation_drain_disabled": false,
"inactive_discrepancy_search_disabled": false,
"balance_tracking_disabled": false,
"coin_tracking_disabled": false,
"status_port": 9090,
"results_output_file": "",
"pruning_disabled": false,
"initial_balance_fetch_disabled": false,
"end_conditions": {
"reconciliation_coverage": {
"coverage": 0.95,
"from_tip": true,
"tip": true
}
}
}
}
59 changes: 59 additions & 0 deletions rosetta/testnet/chain0/configTestnetChain0.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
{
"network": {
"blockchain": "kadena",
"network": "testnet04",
"sub_network_identifier": {
"network": "0"
}
},
"online_url": "http://localhost:1848/chainweb/0.0/testnet04/rosetta",
"data_directory": "logs/testnet/chain0",
"http_timeout": 10,
"max_retries": 5,
"retry_elapsed_time": 0,
"max_online_connections": 120,
"max_sync_concurrency": 64,
"tip_delay": 300,
"max_reorg_depth": 100,
"log_configuration": false,
"compression_disabled": false,
"memory_limit_disabled": false,
"error_stack_trace_enabled": false,
"construction": {
"offline_url": "http://localhost:1848/chainweb/0.0/testnet04/rosetta",
"constructor_dsl_file": "testnet-chain00.ros",
"end_conditions": {
"create_account": 10,
"transfer": 20
}
},
"data": {
"active_reconciliation_concurrency": 16,
"inactive_reconciliation_concurrency": 4,
"inactive_reconciliation_frequency": 250,
"log_blocks": true,
"log_transactions": false,
"log_balance_changes": false,
"log_reconciliations": false,
"ignore_reconciliation_error": false,
"exempt_accounts": "",
"bootstrap_balances": "",
"interesting_accounts": "",
"reconciliation_disabled": false,
"reconciliation_drain_disabled": false,
"inactive_discrepancy_search_disabled": false,
"balance_tracking_disabled": false,
"coin_tracking_disabled": false,
"status_port": 9090,
"results_output_file": "",
"pruning_disabled": false,
"initial_balance_fetch_disabled": false,
"end_conditions": {
"reconciliation_coverage": {
"coverage": 0.95,
"from_tip": true,
"tip": true
}
}
}
}
Loading

0 comments on commit dc5cd93

Please sign in to comment.