Skip to content

Ophash (txID)

Pascal Coin edited this page Nov 17, 2017 · 1 revision

How Ophash works on PascalCoin

Note: OpHash in PascalCoin is similar to txID on other cryptocurrencies

Due to Safebox technology, the operations (also called transactions on other cryptocurrencies) in PascalCoin have an order.
This order is an internal value, called n_operation, and each account in PascalCoin has a n_operation field In order to protect double spending, PascalCoin uses this n_operation field as an INCREMENTAL VALUE, so each operation made in an account has a value n_operation+1 vs previous operation
It's not posible to execute 2 operations with same n_operation over same account. This is a double spend protection

Bitcoin (and clones) does not have this n_operation protection, so it's important to understand/develop properly API calls using this field

All operations (transactions) have an Ophash (32 bytes) that is made with this info:

  • 4 bytes for block number in the blockchain. If this value=0, that means that has NO INFO about which block number is included. So, if value=0, can be 2 reasons: No info, or Not included (pending operation)
  • 4 bytes for account that executes the operation
  • 4 bytes for n_operation
  • 20 bytes for a MD160 hash that is a hash of all the info of the operation

Example: DF5102004AB601000D000000B03277F28E07C93C6E3B7563736D650CBE0A81A8

Decode info: DF510200(block), 4AB60100(account), 0D000000(n_operation), B03277F28E07C93C6E3B7563736D650CBE0A81A8(MD160 hash)

  • Bloc number: DF510200 -> little endian -> 000251DF in hexadecimal = Block 152031
  • Account: 4AB60100 -> little endian -> 0001B64A in hexadecimal = Account 112202
  • n_operation: 0D000000 -> little endian -> 0000000D in hexadecimal = n_operation 13

Some clarifications:

Ophash A=DF5102004AB601000D000000B03277F28E07C93C6E3B7563736D650CBE0A81A8 is the same that B=000000004AB601000D000000B03277F28E07C93C6E3B7563736D650CBE0A81A8, because B block number is "0000000"=0
Both Ophash A and B are correct, but only A Ophash includes info of which block has the operation

Conclusion:

An account CANNOT spend coins if using a bad n_operation value.
If an external App wants to execute JSON-RPC API calls (for example an exchange), must do a correct use of n_operation field, otherwise can produce duplicate operations using same n_operation field and ONLY one will be valid, usually first received by the miner