BitShares Forum

Main => Technical Support => Topic started by: rociy on August 06, 2015, 12:20:57 pm

Title: Arbitrary set of operations in a transaction?
Post by: rociy on August 06, 2015, 12:20:57 pm
Hi,

I apologize in advance for the potentially ignorant question: I'm trying to figure out what's the right way to model / implement a certain financial transaction in using BitShares. For that, I may want to wrap up a few operations into a transaction. Can I do that, or can I only use the set of transactions that are currently defined in the code (e.g., register_account, create_asset, etc.)?

For example: let's assume my use-case requires a transaction of two 'withdraw' operations and one 'short_sell': would that be possible?

Thanks,
    Roy
Title: Re: Arbitrary set of operations in a transaction?
Post by: xeroc on August 06, 2015, 01:15:40 pm
Hi,

I apologize in advance for the potentially ignorant question: I'm trying to figure out what's the right way to model / implement a certain financial transaction in using BitShares. For that, I may want to wrap up a few operations into a transaction. Can I do that, or can I only use the set of transactions that are currently defined in the code (e.g., register_account, create_asset, etc.)?

For example: let's assume my use-case requires a transaction of two 'withdraw' operations and one 'short_sell': would that be possible?

Thanks,
    Roy
Welcome Roy,

In contrast to Bitcoin where you have "script", the operation types you can use in BitShares are predefined. You can find the set of implemented operations here:
https://github.com/cryptonomex/graphene/blob/master/libraries/chain/include/graphene/chain/protocol/operations.hpp#L26-L66

Also note that you can of course "bundle" several operations into a single transaction. And, furthermore, if you need a certain feature you may still create a proposal and have it implemented if shareholders approve.
Title: Re: Arbitrary set of operations in a transaction?
Post by: rociy on August 06, 2015, 03:20:46 pm
Thanks xeroc. So just to make sure I got it right:

True?

Thanks again.
Title: Re: Arbitrary set of operations in a transaction?
Post by: xeroc on August 06, 2015, 05:51:34 pm
Thanks xeroc. So just to make sure I got it right:
  • A transaction contains a set of operations. 
  • The operations are taken from a set of predefined types (details in the source file you pointed to).
  • The specific collection of operations per transaction is user-defined. That is, I can 'bundle' an arbitrary set of operations into a single transaction. 

True?

Thanks again.
Almost .. there exists a transaction size limit (which is a parameter that can be voted up by shareholders if required)