The GAT project is under active development and hence documentation set out below is subject to breaking change, we would advise checking back frequently to ensure that you have the latest code from Github
Having downloaded the code from source, you will need to install dependencies. The JavaScript GAT transaction node requires node js be installed prior to running.
NOTE: For ease, currently the transaction node, fiscal and credit creation subsystems are packaged in one executable. However moving out of the base of phase, these components will be separated to provide devolved administration of the GAT governance structure.
Navigate to the directory where you have downloaded the project, and type
npm install
This will install all dependencies. You can then run the node in test mode by running the following.
node --inspect testchain.js
To run a production node that connects to other peers in debug mode run the following.
node --inspect GAT.js
To run a production node that connects to other peers , and remains running after the terminal session closes, run the following.
forever start GAT.js
To suspend a node running in the background type,
forever stop GAT.js
The documentation is divided into the following sections.
Initially we will cover the overall architecture of the GAT Transaction node, then we will turn to the specifics of the data models that are exchanged.
We will document how the models relate to one another and the process by which additional models can be created.
Archtiecture
Below is a representation of the internals of the GAT Transaction node.
From left to right, every transaction node has a restful API as well as a web socket interface to connect itself to other peers (other transaction nodes). Mobile clients can make requests to the API and bind to the web socket Interface to receive real-time updates from the blockchain array. The rest API is ultimately responsible for writing new blocks to the chain, and the web socket interface purely used as a means of syncing peers and notification distrebution.
In the centre, each of the following blockchains handle specific types of information. Separation of the chains leaves open two possibilities, firstly nodes can in future only record spercific chains , and secondly the architecture allows for differing scaling techniques to be deployed given the difference in density of transactions between the chains.
To the far right we have the fiscal and credit creation subsystems, these interact with the chains in a bidirectional fashion.
The fiscal subsystem interacts with the transaction and fiscal income chains, writing new values to the fiscal chain as revenue is spent (sent to registered public municipal organisations).
The credit creation subsystem mints new units of currency and hence interacts with the transaction and account chains primarily.
Models and relations
The diagram below shows the hierarchy of the data model is used throughout the GAT project. Models can be bound together to form more complex structures based on the following templates.
When data has been entered into the required fields in each model, it can be submitted to the relevant chain. Data not matching the required structure will not be replicated by peers.
GAT Token Model
{
"uuid":"%UUID%",
"from_account_holder_id":"%TO_ACCOUNT_ID%",
"to_account_holder_id":"%TO_ACCOUNT_ID%",
"transaction_currency_symbol":"%VALUE%",
"transaction_currency":"%VALUE%",
"value":"%VALUE%",
"created":"%DATE_TIME%",
"owner_chain":[],
"minting_batch_id":"%MINTING_BTACH_GUID%"
}
GAT Identity Model
{
"id":"%GUID%",
"type":"primary",
"created":"%DATE_CREATED%",
"first_name":"%FIRST_NAME%",
"middle_name":"%MIDDLE_NAME%",
"last_name":"%LAST_NAME%",
"dob":"%DOB%",
"picture":"%PICTURE_BASE64%",
"protected":{
"genasis_key":"%GENKEY%",
"recovery_code":"%REGEN_CODE%",
"identity_hash":"%IDENTITY_HASH%",
"biometrics":[],
"contact":[],
"http://167.71.138.235/gat/assets":[],
"dividends_transactions":[],
"pension_transactions":[],
"locations":[],
"affilliated_org":[]
},
"gat_accounts":[],
"security_delegates_ids":[],
"additional_linked_ids":[],
"authenticated_ locations":[],
"disgressionary_fiscal_distrebution":[],
}
GAT Account Model
{
"uuid":"%UUID%",
"owers_ids":[],
"owners_ids_hashes":[],
"transaction_in":[],
"transaction_out":[],
"transaction_hashes":[],
"chain_hash":"%CHAIN_HASH%",
"protected":{
"genasis_key":"%GENKEY%",
"regen_code":"%REGEN_CODE%"
},
"type":"%TYPE%",
"created":"%CREATED%"
}
GAT Organisation Model
{
"uuid":"%UUID%",
"type":"%TYPE%",
"name":"%ORG_NAME%",
"parent_org_id":"%PARENT_ORG%",
"function:":"%FUNCTION%",
"description:":"%DESCRIPTION%",
"andministrators":[],
"share_templates":[],
"share_holders":[],
"affilliate_divisions":[],
"affilliates":[],
"division_account_ids":[],
"fillings":[],
"created":"%CREATED%",
"status":"%status%",
"division_locations":[]
}
GAT Transaction Model
{
"uuid":"%UUID%",
"to_account_id":"%TO_ACCOUNT_ID%",
"from_account_id":"%FROM_ACCOUNT_ID%",
"value":"%VALUE%",
"created":"%DATE_TIME%",
"authentication_hash":"%AUTH_HASH%",
"old_balance":"%OLD_BAL%",
"signed_new_balance":"%NEW_BAL%",
"location":{
"lat":"%LAT%",
"lng":"%LNG%",
"location_meta_data":"%LOCATION_META_DATA%"
},
"TO_fiscal_capture_subsystem_id":"%TO_FISCAL_SUBSYSTEM_ID%",
"TO_fiscal_contrebution_value":"%TO_CONTRIBUTION_VALUE%",
"TO_fiscal_contrebution_value_perc":"%TO_CONTRIBUTION_VALUE_PERC%",
"FROM_fiscal_capture_subsystem_id":"%FROM_FISCAL_SUBSYSTEM_ID%",
"FROM_fiscal_contrebution_value":"%FROM_CONTRIBUTION_VALUE%",
"FROM_fiscal_contrebution_value_perc":"%FROM_CONTRIBUTION_VALUE_PERC%",
"TO_auth_from_hash":"%TO_AUTH_FLOW_HASH",
"FROM_auth_from_hash":"%FROM_AUTH_FLOW_HASH",
"TO_auth_flow":[],
"FROM_auth_flow":[],
"status":"%STATUS%"
}
Additional safeguards and security measures will be introduced in subsequent versions of the transaction node to prevent malformed JSON files being submitted to the chains.
However while still in beta, every transaction* creates a new block, where the hashing difficulty is set to 1 (implying to mine a subsequent block, the hash must begin with one leading zero) this allows high throughput on a test node as we explore various scaling models.
You can get the last block ID and submit a new block of data with the following command.
var lastBlock=GATTransacitonChain.obtainLatestBlock();
var cid = lastBlock.index;
GATTransacitonChain.addNewBlock(
new CryptoBlock(cid+1, seconds, trans)
);
In the above example we are adding a new array of transactions "trans" to the transactions chain.
You can verify if a transaction has been successfully added to a chain by interacting with the restful API endpoint. In the below example we get a list of all transactions added to the Transaction blockchain.
curl https://vvid.world:4433/getTransactionChain
Gives the following output.
{
"action": "updateChain",
"chain": {
"blockchain": [{
"index": 0,
"timestamp": 1605694728.124,
"data": "Initial Block in the TRANSACTION Chain",
"precedingHash": "0",
"hash": "af4df0842f13058b5cc059ec377c813e5c1c1c1891b788ba5aec5cb4761e44ec",
"nonce": 0
}, {
"index": 1,
"timestamp": 1605721928.066,
"data": [{
"uuid": "8420b1dc-4fe5-45d5-8905-d02bb1fc75cb",
"from_account_holder_id": "GENERSIS",
"to_account_holder_id": "0414DC32-767A-48B2-A15C-E63D973F5314",
"transaction_currency_symbol": "gat",
"transaction_currency": "%VALUE%",
"value": 1,
"created": 1605721928.064,
"owner_chain": ["GENERSIS"]
}, {
"uuid": "8420b1dc-4fe5-45d5-8905-d02bb1fc75cb",
"from_account_holder_id": "GENERSIS",
"to_account_holder_id": "0414DC32-767A-48B2-A15C-E63D973F5314",
"transaction_currency_symbol": "gat",
"transaction_currency": "%VALUE%",
"value": 1,
"created": 1605721928.064,
"owner_chain": ["GENERSIS"]
}, {
"uuid": "8420b1dc-4fe5-45d5-8905-d02bb1fc75cb",
"from_account_holder_id": "GENERSIS",
"to_account_holder_id": "0414DC32-767A-48B2-A15C-E63D973F5314",
"transaction_currency_symbol": "gat",
"transaction_currency": "%VALUE%",
"value": 1,
"created": 1605721928.064,
"owner_chain": ["GENERSIS"]
}, {
"uuid": "8420b1dc-4fe5-45d5-8905-d02bb1fc75cb",
"from_account_holder_id": "GENERSIS",
"to_account_holder_id": "0414DC32-767A-48B2-A15C-E63D973F5314",
"transaction_currency_symbol": "gat",
"transaction_currency": "%VALUE%",
"value": 1,
"created": 1605721928.064,
"owner_chain": ["GENERSIS"]
}, {
"uuid": "8420b1dc-4fe5-45d5-8905-d02bb1fc75cb",
"from_account_holder_id": "GENERSIS",
"to_account_holder_id": "0414DC32-767A-48B2-A15C-E63D973F5314",
"transaction_currency_symbol": "gat",
"transaction_currency": "%VALUE%",
"value": 1,
"created": 1605721928.064,
"owner_chain": ["GENERSIS"]
}, {
"uuid": "8420b1dc-4fe5-45d5-8905-d02bb1fc75cb",
"from_account_holder_id": "GENERSIS",
"to_account_holder_id": "0414DC32-767A-48B2-A15C-E63D973F5314",
"transaction_currency_symbol": "gat",
"transaction_currency": "%VALUE%",
"value": 1,
"created": 1605721928.064,
"owner_chain": ["GENERSIS"]
}, {
"uuid": "8420b1dc-4fe5-45d5-8905-d02bb1fc75cb",
"from_account_holder_id": "GENERSIS",
"to_account_holder_id": "0414DC32-767A-48B2-A15C-E63D973F5314",
"transaction_currency_symbol": "gat",
"transaction_currency": "%VALUE%",
"value": 1,
"created": 1605721928.064,
"owner_chain": ["GENERSIS"]
}]
}]
}
}