3
0
mirror of https://github.com/Qortal/qortal.git synced 2025-02-11 17:55:50 +00:00
catbref 63be6b7e90 Basic block and genesis transaction processing + some refactoring.
DB.rebuild() to shutdown and delete database, then rebuild it (schema only).

DB.callIdentity() to fetch value of IDENTITY column after an INSERT.

Added basic Asset class.

Added TODOs to Account.

BULK REFACTOR to rename "generation target" back to "generating balance" and
"generation signature" back to "generator signature" to ease compatibility with
old QORA for now. (Maybe change again in the future if we change from PoS).

Added support for Block's totalFees which is either loaded from DB
or recalculated as transactions are added to the block.

Also in Block:

* We can't assume generator's public key is the correct length
in case we encounter the GenesisAccount's special 8-byte public key. Fix applied to
Block's ResultSet-based constructor.

* Forgot to save "signature" column!

* Initial version of Block.process()

* Block constructor takes transactionsSignature too now

Added BlockChain startup/init/validation method to determine whether to (re)build blockchain.
Rebuilding blockchain involves rebuilding DB schema, processing GenesisBlock and adding QORA asset.

Added some initial GenesisTranaction.process() code: GenesisTransactions are saved but recipient's balance/reference not yet updated.

Fix incorrect placeholder bind value for "creation" timestamp in Transaction.save().

Moved incremental database schema updates out from "updates" unit test into DatabaseUpdates class.

All unit tests work at this point!
2018-05-25 11:48:47 +01:00
2018-05-16 12:59:15 +01:00
2018-05-16 12:22:48 +01:00

Qora2

To use:

  • Use maven to fetch dependencies.
  • Build project.
  • Fire up an old-gen Qora node.
  • Run src/test/update.java as a JUnit test to build DB structure.
  • Run src/test/migrate.java as a JUnit test to migrate old Qora blocks to DB.

You should now be able to run src/test/load.java and src/test/save.java as JUnit tests demonstrating loading/saving Transactions from/to database.

You can also examine the migrated database using HSQLDB's "sqltool".

It's a good idea to install "rlwrap" (ReadLine wrapper) too as sqltool doesn't support command history/editing!

Typical command line for sqltool would be:

rlwrap java -cp ${HSQLDB_JAR}:${SQLTOOL_JAR} org.hsqldb.cmdline.SqlTool --rcFile=${SQLTOOL_RC} qora

${HSQLDB_JAR} contains pathname to hsqldb-2.4.0.jar, typically ${HOME}/.m2/repository/org/hsqldb/hsqldb/2.4.0/hsqldb-2.4.0.jar

${SQLTOOL_JAR} contains pathname to where you downloaded sqltool-2.2.6.jar

${SQLTOOL_RC} contains pathname to a text file describing Qora2 database, e.g. ${HOME}/.sqltool.rc, with contents like:

urlid qora
url jdbc:hsqldb:file:db/test
username SA
password

You could change the line url jdbc:hsqldb:file:db/test to use a full pathname for easier use.

Another idea is to assign a shell alias in your .bashrc like:

alias sqltool='rlwrap java -cp ${HSQLDB_JAR}:${SQLTOOL_JAR} org.hsqldb.cmdline.SqlTool --rcFile=${SQLTOOL_RC}'

So you can simply type: sqltool qora

Description
Qortal Core - Main Code Repository Decentralized Data Network - Blockchain - TRUE Cross-Chain Trading - Application and Website Hosting - Much More - Qortal is the future internet infrastructure for the global digital world.
https://qortal.dev
Readme 442 MiB
Languages
Java 98%
JavaScript 0.6%
Shell 0.5%
HTML 0.5%
Perl 0.3%