-
Notifications
You must be signed in to change notification settings - Fork 28
Database
Safex blockchain uses LMDB for storing data. LMDB is an abbreviation for Lighting Memory-Mapped Database. It is a software library that provides a high-performance embedded transactional database in form of a key-value store. There are 25 tables used in the Safex blockchain. 15 out of that 25 are the same tables used in Monero and a table for token amounts. The other 10 tables are:
Table name | Key | Key type | Value | Value type |
---|---|---|---|---|
m_output_advanced | output_id | uint64_t | Output advanced data | output_advanced_data_t (blockchain_db.h:153) |
m_output_advanced_type | output_type | tx_out_type | Output key | outkey_advanced |
m_token_staked_sum | interval | uint64_t | staked tokens | |
m_token_staked_sum_total | zero | uint64_t | total staked tokens | |
m_network_fee_sum | interval | uint64_t | SFX amount given to network fee | |
m_token_lock_expiry | block number | uint64_t | output id | |
m_safex_account | username | string | create_account_result | |
m_safex_offer | offer id | crypto::hash | create_offer_result | |
m_safex_feedback | offer id | crypto::hash | safex_feedback_db_data | |
m_safex_price_peg | price peg id | crypto::hash | create_price_peg_result |
After every advanced transaction, m_output_advanced and m_output_advanced_type are each filled with one additional row. Additionally, depending on the transaction, a proper table is also updated.
If a new table needs to be added due to a new transaction type created, the maximum number of tables created must be changed in the code:
if ((result = mdb_env_set_maxdbs(m_env, 25)))
RPC documentation
Advanced functionalities
Blockchain logic and database
Manuals