Skip to content

Commit

Permalink
doc: refine the transaction example in the README (#2072)
Browse files Browse the repository at this point in the history
I tried the command in the readme and met the following errors during my
work
```sh
thread 'main' panicked at bin/fuel-core-client/src/main.rs:52:50:
invalid transaction json: Error("missing field `script`", line: 1, column: 133)
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
```
I replaced it with the `tx` from the test file below by using the
function `to_json()`

https://github.com/FuelLabs/fuel-core/blob/a9e5e89f5fb38e3b3d6e6bdfe1ad339a01f2f3b9/tests/tests/tx.rs#L155-L172
  • Loading branch information
mmyyrroonn authored Aug 19, 2024
1 parent c73431a commit 2aa3463
Showing 1 changed file with 37 additions and 25 deletions.
62 changes: 37 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -196,29 +196,41 @@ RET(RegId::ONE),

```console
$ cargo run --bin fuel-core-client -- transaction submit \
"{\"Script\":{\"script_gas_limit\":1000000,\"policies\":{\"bits\":\"GasPrice\",\"values\":[0,0,0,0]},\"maturity\":0,\"script\":[80,64,0,202,80,68,0,186,51,65,16,0,36,4,0,0],\"script_data\":[],\"inputs\":[
{
\"CoinSigned\": {
\"utxo_id\": {
\"tx_id\": \"c49d65de61cf04588a764b557d25cc6c6b4bc0d7429227e2a21e61c213b3a3e2\",
\"output_index\": 0
"{\"Script\":{
\"body\":{
\"script_gas_limit\":1000000,
\"receipts_root\":\"0000000000000000000000000000000000000000000000000000000000000000\",
\"script\":[80,64,0,202,80,68,0,186,51,65,16,0,36,4,0,0],
\"script_data\":[]
},
\"owner\": \"f1e92c42b90934aa6372e30bc568a326f6e66a1a0288595e6e3fbd392a4f3e6e\",
\"amount\": 10599410012256088338,
\"asset_id\": \"2cafad611543e0265d89f1c2b60d9ebf5d56ad7e23d9827d6b522fd4d6e44bc3\",
\"tx_pointer\": {
\"block_height\": 0,
\"tx_index\": 0
},
\"witness_index\": 0,
\"maturity\": 0,
\"predicate_gas_used\": null,
\"predicate\": null,
\"predicate_data\": null
}
}],\"outputs\":[],\"witnesses\":[{
\"data\": [
150,31,98,51,6,239,255,243,45,35,182,26,129,152,46,95,45,211,114,58,51,64,129,194,97,14,181,70,190,37,106,223,170,174,221,230,87,239,67,224,100,137,25,249,193,14,184,195,15,85,156,82,91,78,91,80,126,168,215,170,139,48,19,5
]
}],\"receipts_root\":\"0x6114142d12e0f58cfb8c72c270cd0535944fb1ba763dce83c17e882c482224a2\"}}"
```
\"policies\":{
\"bits\":\"Maturity | MaxFee\",
\"values\":[0,0,0,0]},
\"inputs\":[{
\"CoinSigned\":{
\"utxo_id\":{
\"tx_id\":\"c49d65de61cf04588a764b557d25cc6c6b4bc0d7429227e2a21e61c213b3a3e2\",
\"output_index\":33298
},
\"owner\":\"f1e92c42b90934aa6372e30bc568a326f6e66a1a0288595e6e3fbd392a4f3e6e\",
\"amount\":4294967295,
\"asset_id\":\"0000000000000000000000000000000000000000000000000000000000000000\",
\"tx_pointer\":{
\"block_height\":0,
\"tx_index\":0
},
\"witness_index\":0,
\"predicate_gas_used\":null,
\"predicate\":null,
\"predicate_data\":null}}],
\"outputs\":[],
\"witnesses\":[{
\"data\":[167,184,58,243,113,131,73,255,233,187,213,245,147,97,92,200,55,162,35,88,241,0,222,151,44,66,30,244,186,138,146,161,73,250,79,15,67,105,225,4,79,142,222,72,74,1,221,173,88,143,201,96,229,4,170,19,75,126,67,159,133,151,149,51]}
]}}"
```

You may meet the error `Transaction is not inserted. UTXO does not exist` due to the UTXO validation. The UTXO validation can be turned off by adding the `--debug` flag.

```console
$ ./target/debug/fuel-core run --db-type in-memory --debug
```

0 comments on commit 2aa3463

Please sign in to comment.