Skip to main content

tx

Usage: chr tx [OPTIONS] OPNAME [ARGS]...

Make a transaction towards a node.

Supports both specifying the target node using url and brid/id or from a
deployment which is specified in the chromia.yml This will post the
transaction asynchronously unless --await is specified, in which it will wait
until transaction has been included in a block.

FT4 compatibility: To make a transaction towards a dapp that uses
ft-authentication, use the --ft-auth flag. This only works if the signer
keypair is connected to a ft-account with the correct authentication rules.
Use --ft-account-id to explicitly state which account to use if keypair is
connected to more than one account. Node: This does not work with
evm-authentication

ICCF: To verify a transaction using ICCF, specify the tx-rid to verify using
--iccf-tx and which chain id the transaction was processed. The command will
both construct and insert a iccf_proof operation prior to the user operation
but will also add the the transaction as a gtx_transaction as first argument
to the user operation.

╭─ Configuration Properties ──────────────────────────────────────────────────╮
│ -cfg, --config=CONFIG Alternate path for client configuration file
│ -s, --settings=SETTINGS Alternate path for project settings file
╰─────────────────────────────────────────────────────────────────────────────╯
╭─ Node ──────────────────────────────────────────────────────────────────────╮
│ │
│ Make query/tx towards a test node
│ │
│ -brid, --blockchain-rid=TEXT Target Blockchain RID │
--cid=INT Target Blockchain IID │
│ --api-url=TEXT Target api url (default: │
│ http://localhost:7740)
╰─────────────────────────────────────────────────────────────────────────────╯
╭─ Deployment ────────────────────────────────────────────────────────────────╮
│ │
│ Make query towards a configured deployment │
│ │
│ -d, --network=TEXT Specify which deployment target to use │
│* -bc, --blockchain=TEXT Name of blockchain in deployment configuration │
╰─────────────────────────────────────────────────────────────────────────────╯
╭─ FT compatible dapps options ───────────────────────────────────────────────╮
│ --ft-auth Adds ft4.ft_auth operation for FT-compatible dapps │
│ --ft-account-id=TEXT Explicitly specify which account to use │
╰─────────────────────────────────────────────────────────────────────────────╯
╭─ Options ───────────────────────────────────────────────────────────────────╮
--secret=PATH Path to secret file (pubkey/privkey)
│ -a, --await Wait for transaction to be included in a block │
-nop Adds a nop to the transaction │
│ --iccf-tx=TEXT Constructs a ICCF-proof for this tx-rid and inserts │
│ iccf_proof operation to the transaction. This will also │
add the tx as a gtx_transaction as first argument to the│
│ operation │
│ --iccf-source=INT Chain id for the chain which the tx to be confirmed has │
│ taken place │
│ -h, --help Show this message and exit
╰─────────────────────────────────────────────────────────────────────────────╯
╭─ Arguments ─────────────────────────────────────────────────────────────────╮
│ OPNAME name of the operation to execute. │
│ ARGS arguments to pass to the operation. (integer: 123) (big_integer: │
│ 1234L) (string: foo, "bar") (bytearray: will be encoded using the │
│ rell notation x"<myByteArray>" and will initially be interpreted as│
│ a hex-string.) (array: [foo,123]) (dict: │
["key1":value1,"key2":value2])
╰─────────────────────────────────────────────────────────────────────────────╯

You can use the tx (transaction) command (chr tx) in the same way as the query command, but you need to sign it with your key pair. It can interact with either a local (Node) or deployed chain without the use of a client.

You can set a path for the project config file (chromia.yml) or specify a different file with the use of --settings. In addition to that, you can change between a local and deployed chain target with the --deployment and --local flags. The flag is --local by default. Use the flag -a or --await to wait for the confirmation or rejection of the transaction. To make the transaction hash unique, use the - nop flag if you need to do the same transaction multiple times.

Node

You can see the Blockchain RID of the local node in the sout. An example would look like the following: Blockchain RID: FC17B67D66F6F35A5D8B75ED3F83AE222FB8C8FCA241624F06285150F10C6BAC If you are running the node on a different URL than the default http://localhost:7740, you can use the --api-url in the chromia.yml to specify it.

  • To perform a transaction with the operation set_name specified in the main.rell file.
chr tx --blockchain-rid <BlockchainRID> --secret .secret set_name "string:name->bob"
  • If you want to pass a dictionary as an argument, you have to single quote it to avoid incorrect shell parsing.
chr tx set_name '["key1":value1,"key2":value2]'

Deployed

Towards a deployed chain, you can do the same commands but need to add a --name (Deployment target) and --blockchain (Name of the chain to query) instead of the --blockchain-rid.

chr tx --network testnet --blockchain my_rell_dapp --secret .secret set_name "string:name->bob"