Skip to content

Commit

Permalink
Update transactions.md (#6783)
Browse files Browse the repository at this point in the history
* Update transactions.md

Made some changes on the Transaction Object for sending raw transactions. The current tx object will result in an error when calling web3.eth.sendSignedTransaction

* Update transactions.md

* Update docs/docs/guides/wallet/transactions.md

Co-authored-by: Alex  <[email protected]>

---------

Co-authored-by: Santiago Trujillo Zuluaga <[email protected]>
Co-authored-by: Alex <[email protected]>
  • Loading branch information
3 people authored Feb 5, 2024
1 parent e5673ca commit a6b685e
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions docs/docs/guides/wallet/transactions.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,13 @@ const account = web3.eth.accounts.privateKeyToAccount('0x4651f9c219fc6401fe0b3f8
// 3rd - create a raw transaction object
const rawTransaction = {
from: account.address,
to: '0x5875da5854c2adadbc1a7a448b5b2a09b26baff8', //random wallet
value: 1, //1 wei
gasPrice: await web3.eth.getGasPrice(),
gasLimit: 300000,
nonce: await web3.eth.getTransactionCount(account.address), //get the current nonce of the account
to: '0x5875da5854c2adadbc1a7a448b5b2a09b26baff8', //random wallet or contract address
value: 1, //optional - value in wei
maxFeePerGas: (await web3.eth.getBlock()).baseFeePerGas * 2n, //updated depending on the network
maxPriorityFeePerGas: 100000, //high
gasLimit: 2000000
nonce: await web3.eth.getTransactionCount(account.address), //optional - get the current nonce of the account
data: "0x0" //optional - encoded function signature and arguments
};

// 4th - sign the raw transaction with the private key
Expand Down Expand Up @@ -342,4 +344,4 @@ Confirmation: {
latestBlockHash: '0xb52380054ad2382620615ba7b7b40638021d85c5904a402cd11d00fd4db9fba9'
}
*/
```
```

2 comments on commit a6b685e

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Benchmark

Benchmark suite Current: a6b685e Previous: 6c075db Ratio
processingTx 9859 ops/sec (±3.40%) 9301 ops/sec (±4.81%) 0.94
processingContractDeploy 41497 ops/sec (±7.39%) 39129 ops/sec (±7.62%) 0.94
processingContractMethodSend 19998 ops/sec (±4.99%) 19443 ops/sec (±5.19%) 0.97
processingContractMethodCall 40922 ops/sec (±6.04%) 38971 ops/sec (±6.34%) 0.95
abiEncode 45871 ops/sec (±7.98%) 44252 ops/sec (±6.92%) 0.96
abiDecode 32094 ops/sec (±7.67%) 30419 ops/sec (±8.89%) 0.95
sign 1666 ops/sec (±0.68%) 1656 ops/sec (±4.08%) 0.99
verify 394 ops/sec (±2.86%) 373 ops/sec (±0.78%) 0.95

This comment was automatically generated by workflow using github-action-benchmark.

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Benchmark

Benchmark suite Current: a6b685e Previous: 6c075db Ratio
processingTx 9430 ops/sec (±4.60%) 9301 ops/sec (±4.81%) 0.99
processingContractDeploy 39401 ops/sec (±7.74%) 39129 ops/sec (±7.62%) 0.99
processingContractMethodSend 19635 ops/sec (±6.90%) 19443 ops/sec (±5.19%) 0.99
processingContractMethodCall 39811 ops/sec (±5.54%) 38971 ops/sec (±6.34%) 0.98
abiEncode 47260 ops/sec (±6.79%) 44252 ops/sec (±6.92%) 0.94
abiDecode 30724 ops/sec (±9.01%) 30419 ops/sec (±8.89%) 0.99
sign 1636 ops/sec (±3.16%) 1656 ops/sec (±4.08%) 1.01
verify 385 ops/sec (±0.49%) 373 ops/sec (±0.78%) 0.97

This comment was automatically generated by workflow using github-action-benchmark.

Please sign in to comment.