You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
description: A discussion of the new Transaction data type
4
4
slug: transactions
5
-
date: 2024-10-03T18:00
6
-
authors: [ asladeofgreen ]
5
+
date: 2025-07-10T18:00
6
+
authors: [ asladeofgreen, melpadden, devendranm ]
7
7
tags: [v2, smartcontracts]
8
8
hide_table_of_contents: false
9
9
---
@@ -18,28 +18,177 @@ In this article we will examine user transactions (previously called deploys).
18
18
19
19
Transactions encapsulate user intents. For example, if Alice intends to transfer CSPR to Bob, she uses software (e.g. a wallet) to construct and sign a transaction that is subsequently dispatched to a trusted node for processing by the network.
20
20
21
-
Transactions may be either 'native' or 'custom':
21
+
Transactions may be either 'native' or 'WASM':
22
22
23
-
- Native transactions are those that interact with system contracts such as mint and/or auction. They do not require any WASM payload to be constructed, are normally compact in size, and are processed directly on the metal, i.e. host-side.
23
+
- Native transactions are those that interact with system contracts such as `mint` and/or `auction`. They do not require any Web Assembly(WASM) payload to be constructed, are normally compact in size, and are processed directly on the metal, i.e. host-side.
24
24
25
-
-Custom transactions are those that interact with the system via either on-chain smart contracts or in-line session logic. All such interactions are based upon user-defined WASM binaries, and are executed within one of the node's supported virtual machines.
25
+
-Web Assembly(WASM) transactions are those that interact with the system via either on-chain smart contracts or session logic. All such interactions are based upon user-defined WASM binaries, and are executed within one of the node's supported virtual machines.
26
26
27
-
In Casper 1.0 there was a single native transaction type (Transfer), and a set of custom transaction types (ContractByHash, ContractByHashVersioned, ContractByName, ContractByNameVersioned, ContractBytes). In Casper 2.0 the set of both native & custome transaction types have been expanded.
27
+
In Casper 1.0 there was a single native transaction type (Transfer), and a set of WASM based transaction types (ContractByHash, ContractByHashVersioned, ContractByName, ContractByNameVersioned, ContractBytes). In Casper 2.0 the set of both native & WASM transaction types have been expanded.
28
28
29
29
Casper 2.0 Native Transaction Types:
30
30
31
-
- System.Mint.Transfer
32
-
- System.Mint.Burn
33
-
- System.Auction.Bid.Submit
34
-
- System.Auction.Bid.Withdraw
35
-
- System.Auction.Delegation.Redelegate
36
-
- System.Auction.Delegation.Submit
37
-
- System.Auction.Delegation.Withdraw
38
-
- System.Auction.Staking.Submit
39
-
- System.Auction.Staking.Withdraw
31
+
|Type|Description|
32
+
|--------|---------------------------------|
33
+
|`add-bid`| To create a bid purse or or increase an existing bidder's bid amount |
34
+
|`activate-bid`| To reactivate an inactive bid |
35
+
|`withdraw-bid`| Used to decrease a validator's stake or remove their bid completely if the remaining stake is below the minimum required amount |
36
+
|`delegate`| Used to add a new delegator or increase an existing delegator's stake |
37
+
|`undelegate`| To reduce a delegator's stake or remove the delegator if the remaining stake is zero |
38
+
|`redelegate`| To reduce a delegator's stake or remove the delegator if the remaining stake is zero. After the unbonding delay, it will automatically delegate to a new validator |
39
+
|`transfer`| Used to reference motes from a source purse to a target purse |
40
40
41
41
Not all work is identical, e.g. a base token (cspr) transfer differs from a smart contract execution.
42
42
43
43
Casper 1.0 supported a set of 6 transaction types, in Casper 2.0 the set is both refined and expanded.
44
44
45
-
The Transaction stat type has a number of changes from its predecessor, the Deploy. For a detailed discussion of these differences you can see the casper documentation of this discussion of the JSON schema.
45
+
The Transaction type has a number of changes from its predecessor, the Deploy.
46
+
47
+
### Deploys and Transactions
48
+
49
+
The Deploy model is deprecated as of Casper 2.0, and support will be removed entirely in a future major release. However, Casper 2.0 will continue to accept valid Deploys and will attempt to execute them. For more details on Transactions, please refer to the Documentation section [here](https://docs.casper.network/concepts/transactions).
50
+
51
+
## How to create a transaction
52
+
53
+
A transaction, such as transferring CSPR tokens from one user's purse to another, can be created and sent to the Casper Network for processing using any of three methods:
54
+
55
+
1. CSPR.Live
56
+
2. SDK [e.g JavaScript/TypeScript SDK]
57
+
3. Casper Client
58
+
59
+
### 1. CSPR.Live
60
+
61
+
You can transfer Casper tokens (CSPR) using any block explorer built to explore the Casper blockchain. The Wallet feature on these block explorers enables transfers to another user's purse, delegate stake, or undelegate stake.
62
+
63
+
[CSPR.Live](https://cspr.live/) is the main and recommended Casper block explorer. For detailed guidance, the [**Transferring Tokens**](https://docs.casper.network/users/token-transfer#transferring-tokens-1) page in the **Users** section of the documentation provides step-by-step instructions on how to transfer CSPR tokens using CSPR.live.
64
+
65
+
### 2. SDK
66
+
67
+
The following example demonstrates how to create and execute a native CSPR token transfer using the JavaScript SDK. This walkthrough shows the complete process of constructing, signing, and submitting a transaction to the Casper Network.
68
+
69
+
#### 2.1. Initialize RPC client with network endpoint
70
+
71
+
This is to establish connection to a Casper node endpoint for network communication.
72
+
73
+
```js
74
+
constrpcHandler=newHttpHandler(ENDPOINT);
75
+
constrpcClient=newRpcClient(rpcHandler);
76
+
```
77
+
78
+
#### 2.2. Load sender's private key securely
79
+
80
+
This is to load the sender's private key from a secure file location using Ed25519 cryptography.
A transaction hash will be returned , which the user can use it to verify the transaction in the Block Explorer like CSPR.Live
134
+
135
+
Below is a screenshot of an example Transfer [transaction](https://cspr.live/transaction/7ef02f29e9589b971615e79bb2325b1bffff144ede2137bb9366497b9fc9afb5) on the Mainnet;
136
+
137
+

138
+
139
+
In this example transaction `7ef02f29e9589b971615e79bb2325b1bffff144ede2137bb9366497b9fc9afb5`, 49, 999.60 CSPR has been transferred from `020396133b3bbbfcf7d1961390f9449e2de5813523180376df361cb31a1ca965b576` to `020312d2d4c4cac436b4c9bd0dc7eba4d129bf5eb05e02f731f7a89221d2fde970c1`
140
+
141
+
The "Raw Data" will give more details about the transaction.
142
+
143
+
### 3. Casper Client
144
+
145
+
A transaction can be initiated by using casper-client-rs CLI. Example V1 (2.0.0) and legacy transfers are given below with the clarity;
CSPR token holders can earn rewards and participate in the protocol through a mechanism called delegation or [staking](https://docs.casper.network/concepts/economics/staking).
185
+
186
+
If a user wants to undelegate tokens from their chosen validator, they can do so at any time.
187
+
188
+
#### Delegate Tokens
189
+
190
+
The tutorial [**Delegating Tokens with a Block Explorer**](https://docs.casper.network/users/delegate-ui) covers in detail how a user can delegate their tokens.
191
+
192
+
#### Undelegate Tokens
193
+
194
+
In order to undelegate their already delegated token, user can follow the step-by-step guide in the [**Undelegating Tokens**](https://docs.casper.network/users/undelegate-ui) section.
0 commit comments