API Reference

cfx_sendRawTransaction - Conflux

Sends a signed transaction into the network for processing.

Parameters

  • DATA, the signed transaction data.
# Basiclly, we follow the workflow of 4 steps to send a transaction:
#    "build transaction" 
# -> "sign transaction" 
# -> "send transaction to the blockchain node(s)" 
# -> "wait for transaction execution result"
# if any account is added to the wallet, the first 3 steps will be combined,
# otherwise you will need to do the first 3 steps individually

This parameter should be signed data, which can only be used once. You can get this through the conflux-web3 SDK, such as js-sdk, go-sdk, and go-sdk. Here's an example of how to obtain signed data.

##please install conflux-web3 first ##$ pip3 install --pre conflux-web3 import os, json, pprint from conflux_web3 import Web3 from conflux_web3.utils import fill_transaction_defaults web3 = Web3(Web3.HTTPProvider("https://conflux-core-public.unifra.io")) signed_txn = web3.cfx.account.sign_transaction(dict( nonce=web3.cfx.get_transaction_count("your-address"), maxFeePerGas=3000000000, maxPriorityFeePerGas=2000000000, gas=100000, to='0x03710d048ED9FEb4eD09431a14C3BeF538281F36', value=50000, data=0x7b2274696d65223a313636343030373735353533322c2274797065223a22696e666f222c226d7367223a22576562332054657374212121227d, type=2, chainId=11155111, ), "your-secret-key", ) print(signed_txn.rawTransaction)
params: [ '0xf86eea8201a28207d0830f4240943838197c0c88d0d5b13b67e1bfdbdc132d4842e389056bc75e2d631000008080a017b8b26f473820475edc49bd153660e56b973b5985bbdb2828fceacb4c91f389a03452f9a69da34ef35acc9c554d7b1d63e9041141674b42c3abb1b57b9f83a2d3' ]

Returns

DATA, 32 Bytes - The transaction hash.


Example

Request

curl -X POST \ --data '{"jsonrpc":"2.0","method":"cfx_sendRawTransaction","params": [ "0xf86eea8201a28207d0830f4240943838197c0c88d0d5b13b67e1bfdbdc132d4842e389056bc75e2d631000008080a017b8b26f473820475edc49bd153660e56b973b5985bbdb2828fceacb4c91f389a03452f9a69da34ef35acc9c554d7b1d63e9041141674b42c3abb1b57b9f83a2d3" ],"id":1}' \ -H "Content-Type: application/json" \ https://cfx-core.unifra.io/v1/ad2eb3c7a9404cc6a35a6641eaf70577

Result

{ "id":1, "jsonrpc": "2.0", "result": "0xf5338a6cb85d10acc9108869f94fe322b2dfa2715d16d264676c91f6a0404b61" }
Path Params
string
required
Body Params
string
Defaults to 2.0
string
Defaults to cfx_sendRawTransaction
params
array of strings
params
int32
Defaults to 0
Responses

Language
URL
Click Try It! to start a request and see the response here! Or choose an example:
application/json