Author Topic: Settlement of limit orders on the Bitshares blockchain  (Read 3804 times)

0 Members and 1 Guest are viewing this topic.

Offline abit

  • Committee member
  • Hero Member
  • *
  • Posts: 4669
    • View Profile
    • Abit's Hive Blog
  • BitShares: abit
  • GitHub: abitmore
Thank you for your answer! Does that mean that nodes that replay the blockchain, derive (the results of) virtual operations from the operations inside the blockchain?
virtual operations ARE results.
BitShares committee member: abit
BitShares witness: in.abit

Offline devos50

  • Newbie
  • *
  • Posts: 3
    • View Profile
Thank you for your answer! Does that mean that nodes that replay the blockchain, derive (the results of) virtual operations from the operations inside the blockchain?

Offline abit

  • Committee member
  • Hero Member
  • *
  • Posts: 4669
    • View Profile
    • Abit's Hive Blog
  • BitShares: abit
  • GitHub: abitmore
Basic concepts.

The blockchain itself only stores blocks which contain transactions which contain operations. It's just a series of actions, like binary log of any traditional database.

get_block API reads from this.

Witness_node read data from the blockchain and process them and store populated data, including virtual operations, accounts, balances and other data, in its internal object database.

get_account_history API reads from this.
BitShares committee member: abit
BitShares witness: in.abit

Offline devos50

  • Newbie
  • *
  • Posts: 3
    • View Profile
Ok, I found out about virtual operations and when querying the account history, I see the expected fill_order_operation there. Still, I wonder whether they are stored explicitly in the blockchain?

Offline devos50

  • Newbie
  • *
  • Posts: 3
    • View Profile
Hi guys,

I'm doing a PhD in blockchain technology where I analyse some decentralized exchanges from an experimental perspective. For one of my publications, I'm doing an evaluation of Bitshares and the underlying Graphene blockchain.

I've successfully setup a separate testnet on our supercomputer and performed a few trades on it, between two user-issued assets. In particular, I'm creating two limit orders, an ask and a bid, with the same quantity and price (so they should match). After the experiment is done, I print the balances of the assets for each account involved. I observed that the trade has been completed successfully. During the experiment, I use a single witness node that produces a block every five seconds.

Now, I want to explore the blockchain and understand how it works and how the trade is settled. By dumping the contents of the blockchain, I successfully see the two limits order being created. However, I am puzzled by the fact that there is no indication on the blockchain that these two limit orders are matched and that the assets are settled! I would expect that there is another asset transfer operation. Instead, there are no operations performed after the limit orders are created, while the account balances are updated correctly when querying them.

Can anyone explain why this happens? Could it be that there's something wrong with my setup?

Thanks!

Last block with operations in it (this is the block where the limit orders are created):

Code: [Select]
{
    "block_id": "0000001fa99a60e20d9915db7f6de12dc48cb8de",
    "extensions": [],
    "previous": "0000001eacf24c1d0b8e70929f4aee02b0385bc7",
    "signing_key": "BTS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV",
    "timestamp": "2018-04-17T14:13:05",
    "transaction_ids": [
        "1256757f3807680ae221ebae5e62c28cbd5853e1",
        "b8f4428c989ebaa96a6b89966f67d8d8e40b8c11"
    ],
    "transaction_merkle_root": "b32dc902c55b6362ed4d452b3fdfdbc083983e4f",
    "transactions": [
        {
            "expiration": "2018-04-17T14:13:30",
            "extensions": [],
            "operation_results": [
                [
                    1,
                    "1.7.0"
                ]
            ],
            "operations": [
                [
                    1,
                    {
                        "amount_to_sell": {
                            "amount": 2000000,
                            "asset_id": "1.3.2"
                        },
                        "expiration": "2018-04-17T15:13:04",
                        "extensions": [],
                        "fee": {
                            "amount": 500000,
                            "asset_id": "1.3.0"
                        },
                        "fill_or_kill": false,
                        "min_to_receive": {
                            "amount": 2000000,
                            "asset_id": "1.3.1"
                        },
                        "seller": "1.2.18"
                    }
                ]
            ],
            "ref_block_num": 30,
            "ref_block_prefix": 491582124,
            "signatures": [
                "20262122fcef8e8b7ee888cc83dee02ba572a00f5a58cfc170cb88e9c6ae49293069aac2a482f73aacd5feddfbb82051a24e4f2d53f9ff8f65372cf5a2aa47012b"
            ]
        },
        {
            "expiration": "2018-04-17T14:13:30",
            "extensions": [],
            "operation_results": [
                [
                    1,
                    "1.7.1"
                ]
            ],
            "operations": [
                [
                    1,
                    {
                        "amount_to_sell": {
                            "amount": 2000000,
                            "asset_id": "1.3.1"
                        },
                        "expiration": "2018-04-17T15:13:04",
                        "extensions": [],
                        "fee": {
                            "amount": 500000,
                            "asset_id": "1.3.0"
                        },
                        "fill_or_kill": false,
                        "min_to_receive": {
                            "amount": 2000000,
                            "asset_id": "1.3.2"
                        },
                        "seller": "1.2.19"
                    }
                ]
            ],
            "ref_block_num": 30,
            "ref_block_prefix": 491582124,
            "signatures": [
                "2021d28d033f7af004ed4508c8a86225bef9df705611159c6db237f00539aed49b34a79771311effddf8f1810ff928905aced32b816ac0eac0d521efc22435fe46"
            ]
        }
    ],
    "witness": "1.6.1",
    "witness_signature": "1f4a04a2f34da8ce473dacfca92a07aac3ced358cf6287df390b8d012f7834469c5e971e91d97dbf618a0c5d8f1435b2b56e711c5aba5a9d02e54d5b514b1e74f0"
}
« Last Edit: April 17, 2018, 02:40:12 pm by devos50 »