kevacoin-project / kevacoin

Kevacoin source tree
https://www.kevacoin.org
MIT License
32 stars 16 forks source link

Question about the OP_KEVA_DELETE opcode processing #23

Open ghost opened 3 years ago

ghost commented 3 years ago

I'm writing an indexing script, so want to actualize the data on receiving new blocks.

Do I understand it right, that data not physically removing from the previous blocks, just we have OP_KEVA_DELETE marker in the last block incoming, that means to 'hide' the data stored before?

Thanks.

ghost commented 3 years ago

It's seems that data have physically removed, and unfortunately I've deleted the example for the #24 issue, when testing that :)

ghost commented 3 years ago

I need to clarify my question:

if I receive transaction with OP_KEVA_DELETE marker, how could I know which transaction ID should be deleted (if I have 2 same key/value pairs, for example). I think, that deletion transaction should contain some hash/ID of the target one.

Put example

block 359471
Array
(
    [value] => 0.01
    [n] => 1
    [scriptPubKey] => Array
        (
            [asm] => OP_KEVA_PUT 356a893ac5dbc64229a0700d63b019c72e5227644d 746573742064656c657465206b6579 746573742064656c6574652076616c7565 OP_2DROP OP_DROP OP_HASH160 a63bd4014af78762d13a2bb5ed6241d9a09ea269 OP_EQUAL
            [hex] => d115356a893ac5dbc64229a0700d63b019c72e5227644d0f746573742064656c657465206b657911746573742064656c6574652076616c75656d75a914a63bd4014af78762d13a2bb5ed6241d9a09ea26987
            [reqSigs] => 1
            [type] => scripthash
            [addresses] => Array
                (
                    [0] => VRpBmNtNmzUo1PsAAPmx7Ev7eeUcTW2kVA
                )

        )

)

Delete example

block 359473
Array
(
    [value] => 0.01
    [n] => 0
    [scriptPubKey] => Array
        (
            [asm] => OP_KEVA_DELETE 356a893ac5dbc64229a0700d63b019c72e5227644d 746573742064656c657465206b6579 OP_2DROP OP_HASH160 177adffd4fde22bd294bad4b2ec213b78cb1a4b5 OP_EQUAL
            [hex] => d215356a893ac5dbc64229a0700d63b019c72e5227644d0f746573742064656c657465206b65796da914177adffd4fde22bd294bad4b2ec213b78cb1a4b587
            [reqSigs] => 1
            [type] => scripthash
            [addresses] => Array
                (
                    [0] => VCoNfWsbv1h6Hg1mTU8vRzVt8PgZ418Auj
                )

        )

)
ghost commented 3 years ago

Experimentally, I've get error on trying to remove second (the same) key/value pair in the namespace. Suppose, that is a bug or maybe nice idea for the future protocol enhancement.

Screenshot from 2021-07-08 20-51-31

Finally, the removing action operates with the key/values pairs so.