Author Topic: what do a transfer include in BTS  (Read 1792 times)

0 Members and 1 Guest are viewing this topic.

Offline pc

  • Hero Member
  • *****
  • Posts: 1530
    • View Profile
    • Bitcoin - Perspektive oder Risiko?
  • BitShares: cyrano
Is there anything specific that you want to know?

The internal database of a full node can be queried with a few simple commands in the cli_wallet, for example

Code: [Select]
locked >>> get_account 1.2.28788
get_account 1.2.28788
{
  "id": "1.2.28788",
...
  "name": "cyrano",
...
}

Edit: the ref_block_num and ref_block_prefix is only to prove that the creator of the transaction has seen the given block with the given prefix. So the same transaction couldn't be used in a different fork of the chain that doesn't include that particular block. These values have nothing to do with the transfer operation.
« Last Edit: December 20, 2015, 02:44:03 pm by pc »
Bitcoin - Perspektive oder Risiko? ISBN 978-3-8442-6568-2 http://bitcoin.quisquis.de

Offline BTSdac

  • Hero Member
  • *****
  • Posts: 1219
    • View Profile
  • BitShares: K1
This is what a transaction with a single transfer operation without a memo looks like:

Code: [Select]
{
      "ref_block_num": 65534,
      "ref_block_prefix": 878476643,
      "expiration": "2015-11-07T21:12:09",
      "operations": [[
          0,{
            "fee": {
              "amount": 4000000,
              "asset_id": "1.3.0"
            },
            "from": "1.2.28788",
            "to": "1.2.97102",
            "amount": {
              "amount": 10000000,
              "asset_id": "1.3.0"
            },
            "extensions": []
          }
        ]
      ],
      "extensions": [],
      "signatures": [
        "1f4a55c5ae64ba8084d20583697a45e73f54abebe72d11bf388a9258e6125859956356e9021c51f015b68885b5023f6b3a2d9f733c3f79ad10331e658fdd872b64"
      ],
      "operation_results": [[
          0,{}
        ]
      ]
    }

The identification information of sender and receiver is the account ids in the "from" and "to" fields.
Note that "coins" are handled differently from Bitcoin in that BitShares keeps an internal ledger of accounts and balances, whereas Bitcoin uses unspent transaction outputs.
do you know the detail of internal ledger of accounts and balances
it seems that a sender cannot send a same amount of asset to same receiver  in one block that would make same  "ref_block_num" ,"ref_block_prefix" and "expiration"?
Code: [Select]
FC_ASSERT( (skip & skip_transaction_dupe_check) ||
              trx_idx.indices().get<by_trx_id>().find(trx_id) == trx_idx.indices().get<by_trx_id>().end() );
   transaction_evaluation_state eval_state(this);
« Last Edit: December 20, 2015, 02:38:34 pm by BTSdac »
github.com :pureland
BTS2.0 API :ws://139.196.37.179:8091
BTS2.0 API 数据源ws://139.196.37.179:8091

Offline pc

  • Hero Member
  • *****
  • Posts: 1530
    • View Profile
    • Bitcoin - Perspektive oder Risiko?
  • BitShares: cyrano
This is what a transaction with a single transfer operation without a memo looks like:

Code: [Select]
{
      "ref_block_num": 65534,
      "ref_block_prefix": 878476643,
      "expiration": "2015-11-07T21:12:09",
      "operations": [[
          0,{
            "fee": {
              "amount": 4000000,
              "asset_id": "1.3.0"
            },
            "from": "1.2.28788",
            "to": "1.2.97102",
            "amount": {
              "amount": 10000000,
              "asset_id": "1.3.0"
            },
            "extensions": []
          }
        ]
      ],
      "extensions": [],
      "signatures": [
        "1f4a55c5ae64ba8084d20583697a45e73f54abebe72d11bf388a9258e6125859956356e9021c51f015b68885b5023f6b3a2d9f733c3f79ad10331e658fdd872b64"
      ],
      "operation_results": [[
          0,{}
        ]
      ]
    }

The identification information of sender and receiver is the account ids in the "from" and "to" fields.
Note that "coins" are handled differently from Bitcoin in that BitShares keeps an internal ledger of accounts and balances, whereas Bitcoin uses unspent transaction outputs.
Bitcoin - Perspektive oder Risiko? ISBN 978-3-8442-6568-2 http://bitcoin.quisquis.de

Offline BTSdac

  • Hero Member
  • *****
  • Posts: 1219
    • View Profile
  • BitShares: K1
there is lack technical documents to explain what does a transfer and operation contain?
I understand from code 
a transfer should contain
1.chain ID ,sender ,receiver ,amount, asset symbol . and digest of them
2. signature of required keys
what is more ?  there have identification information/ that prove sender how to gain the sending coin,  I don`t know if have similar in btc?
github.com :pureland
BTS2.0 API :ws://139.196.37.179:8091
BTS2.0 API 数据源ws://139.196.37.179:8091