Base eth_sendRawTransaction
Introduce how to integrate BlockRazor Base RPC’s `eth_sendRawTransaction` method.
Endpoint
Region
Endpoint
Frankfurt
frankfurt.grpc.base.blockrazor.xyz:80
Virginia
virginia.grpc.base.blockrazor.xyz:80
Tokyo
tokyo.grpc.base.blockrazor.xyz:80
Region
Endpoint
Frankfurt
https://frankfurt-base.blockrazor.io:10101/eth_sendRawTransaction
Virginia
https://virginia-base.blockrazor.io:10101/eth_sendRawTransaction
Tokyo
https://tokyo-base.blockrazor.io:10101/eth_sendRawTransaction
Request Parameter
Parameter
Mandatory
Format
Example
Remark
rawTransaction
mandatory
string[hex]
"0xd46e8dd67c5d32be8d24c6b0afe7c5c3f4e9c3b2dae18d0c6b0cf5c8f3e8b2c1"
signed raw transaction
Request Example
Access the example here
// sendTransactions is an example function for sending a transaction.
// It's designed to reuse an existing gRPC client connection to avoid connection latency.
func sendTransactions(client basepb.BaseApiClient, authToken string, rawTxString string) {
log.Println("[SendTx] Sending transaction...")
ctx, cancel := context.WithTimeout(context.Background(), 3*time.Second)
defer cancel()
// Add the authentication token to the outgoing request's metadata.
md := metadata.Pairs("authorization", authToken)
ctx = metadata.NewOutgoingContext(ctx, md)
req := &basepb.SendTransactionRequest{
RawTransaction: rawTxString,
}
res, err := client.SendTransaction(ctx, req)
if err != nil {
log.Printf("[SendTx] Failed to send transaction: %v", err)
} else {
log.Printf("[SendTx] Transaction sent successfully. Hash: %s", res.GetTxHash())
}
}proto
Response
Normal
Abnormal
Last updated
Was this helpful?