@@ -4,21 +4,9 @@ description: "Learn how Sui transactions work: structure, commands, gas payments
44
55# Transaction
66
7- Transaction is a fundamental concept in the blockchain world. It is a way to interact with a
8- blockchain. Transactions are used to change the state of the blockchain, and they are the only way
9- to do so. In Move, transactions are used to call functions in a package, deploy new packages, and
10- upgrade existing ones.
11-
12- <!--
13-
14- - how user interacts with a program
15- - mention public functions
16- - give a concept of an entry / public function without getting into details
17- - mention that functions are called in transactions
18- - mention that transactions are sent by accounts
19- - every transaction specifies object it operates on
20-
21- -->
7+ A transaction is the fundamental way to interact with a blockchain. Transactions are used to
8+ change the state of the blockchain, and they are the only way to do so. On Sui, a transaction can
9+ call functions in published packages, deploy new packages, and upgrade existing ones.
2210
2311## Transaction Structure
2412
@@ -31,11 +19,11 @@ Transactions consist of:
3119- command inputs - the arguments for the commands: either ` pure ` - simple values like numbers or
3220 strings, or ` object ` - objects that the transaction will access;
3321- a gas object - the ` Coin ` object used to pay for the transaction;
34- - gas price and budget - the cost of the transaction;
22+ - a gas price and budget - the cost of the transaction.
3523
3624## Inputs
3725
38- Transaction inputs are the arguments for the transaction and are split between 2 types:
26+ Transaction inputs are the arguments for the transaction, and come in two types:
3927
4028- Pure arguments: These are mostly [ primitive types] ( ../move-basics/primitive-types ) with some extra
4129 additions. A pure argument can be:
@@ -47,7 +35,7 @@ Transaction inputs are the arguments for the transaction and are split between 2
4735 - [ ` std::ascii::String ` ] ( ../move-basics/string#ascii-strings ) , ASCII strings.
4836 - [ ` vector<T> ` ] ( ../move-basics/vector ) , where ` T ` is a pure type.
4937 - [ ` std::option::Option<T> ` ] ( ../move-basics/option ) , where ` T ` is a pure type.
50- - [ ` std ::object::ID` ] ( ../storage/uid-and-id ) , typically points to an object. See also
38+ - [ ` sui ::object::ID` ] ( ../storage/uid-and-id ) , typically points to an object. See also
5139 [ What is an Object] ( ../object/object-model ) .
5240- Object arguments: These are objects or references of objects that the transaction will access. An
5341 object argument needs to be either a shared object, a frozen object, or an object that the
@@ -61,6 +49,13 @@ publishing a package) or a call to a function in an already published package. T
6149executed in the order they are listed in the transaction, and they can use the results of the
6250previous commands, forming a chain. Transaction either succeeds or fails as a whole.
6351
52+ Any [ ` public ` ] ( ../move-basics/visibility#public-visibility ) function can be called as a command:
53+ making a function ` public ` is all it takes for users to call it in a transaction, and it is the
54+ default way to expose functionality in Move. (There is also the
55+ [ ` entry ` ] ( ../move-basics/visibility#entry-modifier ) modifier, which creates functions callable
56+ _ only_ as transaction commands - a deliberately restricted option, covered in the
57+ [ Entry Functions] ( ../move-advanced/entry-functions ) section.)
58+
6459Schematically, a transaction looks like this (in pseudo-code):
6560
6661```
@@ -81,10 +76,6 @@ In this example, the transaction consists of three commands:
8176 with the given arguments - the ` payment ` object;
82773 . ` TransferObjects ` - a built-in command that transfers the object to the recipient.
8378
84- <!--
85- > There are multiple different implementations of transaction building, for example
86- -->
87-
8879## Transaction Effects
8980
9081Transaction effects are the changes that a transaction makes to the blockchain state. More
@@ -104,4 +95,12 @@ The result of the executed transaction consists of different parts:
10495- Events - the custom [ events] ( ./../programmability/events ) emitted by the transaction;
10596- Object Changes - the changes made to the objects, including the _ change of ownership_ ;
10697- Balance Changes - the changes made to the aggregate balances of the account involved in the
107- transaction;
98+ transaction.
99+
100+ ## Further Reading
101+
102+ - [ Transactions] ( https://docs.sui.io/concepts/transactions ) in the Sui Documentation.
103+ - [ Programmable Transaction Blocks] ( https://docs.sui.io/concepts/transactions/prog-txn-blocks ) in
104+ the Sui Documentation.
105+ - [ Using Address Balances] ( https://docs.sui.io/onchain-finance/asset-custody/address-balances/using-address-balances )
106+ in the Sui Documentation - paying gas and moving funds without a ` Coin ` object.
0 commit comments