LogoLogo
  • Introduction
  • Radius testnet access
  • Quickstart
    • Command line
    • Go
    • JavaScript
    • Postman
    • Python
    • Rust
    • TypeScript
  • How to
    • Create a Private Key
    • Get testnet ETH tokens
    • Deploy a smart contract
  • Concepts
    • Ethereum transaction types
  • Tutorials
  • Radius SDKs
  • API Reference
    • eth_blockNumber
    • eth_call
    • eth_chainId
    • eth_createAccessList
    • eth_estimateGas
    • eth_feeHistory
    • eth_gasPrice
    • eth_getBalance
    • eth_getBlock
    • eth_getBlockByHash
    • eth_getBlockByNumber
    • eth_getBlockTransactionCountByHash
    • eth_getBlockTransactionCountByNumber
    • eth_getCode
    • eth_getLogs
    • eth_getStorageAt
    • eth_getTransactionByBlockHashAndIndex
    • eth_getTransactionByBlockNumberAndIndex
    • eth_getTransactionByHash
    • eth_getTransactionCount
    • eth_getTransactionReceipt
    • eth_sendRawTransaction
    • eth_sendTransaction
    • net_version
    • web3_clientVersion
    • web3_sha3
    • web3_getTransactionCount
  • Release Notes
  • Whitepaper
  • Radius Discord
Powered by GitBook
On this page

Was this helpful?

Edit on GitHub
  1. Quickstart

Python

PreviousPostmanNextRust

Last updated 3 months ago

Was this helpful?

1

In your project folder, install the requests library:

pip install requests
2

Create a Python file called index.py:

import json
import requests

url = "https://rpc.testnet.tryradi.us/<YOUR-RPC-ENDPOINT>"

payload = {
    "jsonrpc": "2.0",
    "method": "eth_blockNumber",
    "params": [],
    "id": 1
}

headers = {'content-type': 'application/json'}

response = requests.post(url, data=json.dumps(payload), headers=headers).json()

print(response)
3

Run the code using the following command:

python index.py
1

In your project folder, install the web3 library:

pip install web3
2

Create a Python file called index.py:

from web3 import Web3

url = "https://rpc.testnet.tryradi.us/<YOUR-RPC-ENDPOINT>"

w3 = Web3(Web3.HTTPProvider(url))

latest_block = w3.eth.get_block_number()

print(f"Latest block number: {latest_block}")
3

Run the code using the following command:

python index.py