Skip to content

Tech: [blockchain-object] : TransactionType - CreateBlockchainObject #1295

Open
@andy-shi88

Description

@andy-shi88

Description

Create a transaction type to create blockchain object. This transaction type should have the following body fields:

- BlockchainObjectBalance - int64
- BlockchainObjectImmutableProperty: [
      key: string,
      value: string,
  ]

There will be 2 additional table to manage blockchain object:

  • blockchain_object
no field db_type
1 id []byte
2 owner []byte
3 height uint32
  • blockchain_object_property [immutable-property of blockchain object]
no field db_type
1 blockchain_object_id []byte
2 key string
3 value string
4 height uint32

Behaviour

  • ApplyUnconfirmed

    • Deduct tx.fee + blockchain_object_balance from sender spendable balance (even if the sender is blockchain object too)
  • UndoApplyUnconfirmed

    • refund the cut balance
  • ApplyConfirmed

    • Deduct tx.fee + blockchain_object_balance from sender balance (even if the sender is blockchain object too)
    • generate new blockchain_object_id which is [4byte_blockchain_object_accountType][32bytes_tx_hash]
    • insert blockchainObject { owner: tx.Sender, id: blockchain_object_id } to blockchain_object table.
    • insert new row in account_balance table, where the address is blockchain_object_id
    • insert every blockchain object's property to blockchain_object_property table.

Breakdown

  • update migration
  • create bo transaction type.

Additional Diagram / File

Put additional diagram or file

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions