---
title: Ticket transfer blog post
tags: ticket
---
# Ticket transfer
Tickets are important. On Tezos blockchain, they can be used as non-fungible tokens in smart contracts and smart rollups.
There has been an overhaul of the ownership system of Tezos tickets in the latest protocol proposal.
In this blog post, we will demonstrate how tickets can be transferred between different entities on the Tezos blockchain in the new proposal.
## From an originated contract to an implicit account
Naturally, the lifecycle of a ticket starts from construction of it by a Tezos smart contract. It may be held by an implicit account, like a promise to a service to a person behind the implicit account. To "hand out" this ticket, the contract just needs to construct a `contract (ticket content_ty)` contract handle to the receiving implicit account, given that `content_ty` is the type of the ticket content. For instance, we may transfer a `string` ticket with the following instructions.
# stack: address : <...>
CONTRACT (ticket string) ;
# stack: option (contract (ticket string)) : <...>
ASSERT_SOME ;
# stack: contract (ticket string) : <...>
PUSH mutez 0 ;
# stack: mutez : contract (ticket string) : <...>
PUSH nat 1 ;
# stack: nat : mutez : contract (ticket string) : <...>
PUSH string "Lorem Ipsum" ;
# stack: string : nat : mutez : contract (ticket string) : <...>
TICKET ;
ASSERT_SOME ;
# stack: ticket string : mutez : contract (ticket string) : <...>
TRANSFER_TOKENS ;
# stack: operation : <...>
If you work with CameLigo, this is how it gets done.
```ocaml=
let addr : address = ... in
let ticket =
match Tezos.create_ticket "Lorem Ipsum" 1n with
None -> (failwith "ticket creation must succeed" : string ticket)
| Some ticket -> ticket
in
let contract =
Tezos.get_contract_with_error
addr
"destination does not accept tickets"
in
let operation = Tezos.transfer ticket 0tez contract in
...
```
So at the end of the execution, we will have an internal operation on the top of the stack. It will transfer the ticket construct with content `"Lorem Ipsum"` to the implicit account.
## From an originated contract to another originated contract
At the moment, ticket transfer between originated contracts is already possible. For completeness, an example of transfering a `string` ticket is given below.
# stack: address : <...>
CONTRACT %your_desired_entrypoint (ticket string) ;
# stack: option (contract (ticket string)) : <...>
ASSERT_SOME ;
# stack: contract (ticket string) : <...>
PUSH mutez 0 ;
# stack: mutez : contract (ticket string) : <...>
PUSH nat 1 ;
# stack: nat : mutez : contract (ticket string) : <...>
PUSH string "Lorem Ipsum" ;
# stack: string : nat : mutez : contract (ticket string) : <...>
TICKET ;
ASSERT_SOME ;
# stack: ticket string : mutez : contract (ticket string) : <...>
TRANSFER_TOKENS ;
# stack: operation : <...>
This example shares a striking resemblance with the implicit account transfer above, except that you may require to specify the entrypoint of the target contract.
## From one implicit account to another implicit account
Tezos allows the ownership of a ticket to be transferred to another implicit account. From the perspective of a wallet, the manager operation `Transfer_ticket` can be submitted to initiate this transfer. Let us take `octez-client` as our wallet implementation here to request a transfer of a `string` ticket to another implicit account.
octez-client transfer 1 tickets from bob to alice with entrypoint default and content '"Lorem Ipsum"' and type string and ticketer 'ticketer'
## From an implicit account to an originated contract
You may have guessed it. Yes, the same `Transfer_ticket` operation works for transferring tickets from implicit accounts to smart contracts. Unlike the previous case, you may have to use a different entrypoint according to the specification of the receiving contract.
octez-client transfer 1 tickets from bob to some_contract with entrypoint receive and content '"Lorem Ipsum"' and type string and ticketer 'ticketer'
## Smart optimistic rollup
In the current smart optimistic rollup design, smart contracts can send tickets to smart rollups and conversely smart rollups can send tickets to smart contracts. Since *modus operandi* of smart rollups are similar to contract calls, the same examples work out of box with smart rollup destinations. As the design of smart rollups reaches maturity, we anticipate more tools and documentation to be published about use of tickets in the rollup scene as well.
## Summary
The new ticket capabilities in the new protocol proposal `M` opens new opportunities in Tezos ecosystem. We foresee a great potiential from the flexible ticket ownership system that new applications and services can immensively benefit from. This would encourage new patterns in blockchain services and permission management. We encourage developers to explore the possible use cases with tickets.
Happy hacking!