Signing transactions

Your app will need to send transactions to the Casper network. Such operations must be approved by the user by signing what we call in Casper a deploy.

How to build a deploy object is out of the scope of this documentation. We recommend to refer to the official Casper docs on this topic. Note that your frontend web application does not necessarily always create the deploy. In some scenarios, that can be a responsibility of your backend application or even another party.

In any case, at some point you will have a deploy in the form of a json object. Removing the payment and session details for the sake of simplicity, it will look like this:

    "hash": "5803e985c113a5d4d24bef4cd8cbb01dc546a1d138756c406880858eb44380e2",
    "header": {
      "account": "020339898123654b6290f1b36c794393514d355e006336d1bc2c1c4ca84596d68f02",
      "timestamp": "2023-08-30T21:50:48.627Z",
      "ttl": "30m",
      "gas_price": 1,
      "body_hash": "024f684ba6d35436296377aa428f7fc9dbe72412ba8eaec8130a86276a32d385",
      "dependencies": [],
      "chain_name": "casper"
    "payment": {
    "session": {
    "approvals": []

Typically, you'll handle a deploy without approvals. And such approval is what you want to get from the user. Then, the deploy will be ready to be processed by a Casper node.

To get the approval SDK offers two options:

  • send() method. Use it to ask to request the user to approve the transaction and then send it to a Casper node, where it will be processed.

  • sign() method. Use it to ask to request the user to approve the transaction and return to you the signature value.

In most cases, you can just use the send() method and process its result to communicate to the user whether the operation is being processed in the Casper network or it has been rejected for some reason.

But in some advanced scenarios you will require the sign() method and get the signature to continue the processing of the transaction.

Last updated