Skip to content

A python interface for interacting with the PlatON network

License

Notifications You must be signed in to change notification settings

cheng762/client-sdk-python

 
 

Repository files navigation

client-sdk-python

Join the chat at https://gitter.im/ethereum/web3.py

Build Status

A Python implementation of web3.js

  • Python 3.6+ support

Read more in the documentation on ReadTheDocs. View the change log on Github.

Quickstart

from web3 import Web3, HTTPProvider
from web3.eth import PlatON
from hexbytes import HexBytes

# get blockNumber
w3 = Web3(HTTPProvider("http://localhost:6789"))
platon = PlatON(w3)
block_number = platon.blockNumber
print(block_number)

# get Balance
address = '0x493301712671Ada506ba6Ca7891F436D29185821'
balance = platon.getBalance(address)
print(balance)

# sendtransaction
to = '0xC1f330B214668beAc2E6418Dd651B09C759a4Bf5'
w3.personal.unlockAccount(address, "password", 60)
data = {
    "from": address,
    "to": to,
    "value": 0x10909,
}
transaction_hex = HexBytes(platon.sendTransaction(data)).hex()
result = platon.waitForTransactionReceipt(transaction_hex)
print(result)

About

A python interface for interacting with the PlatON network

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 99.9%
  • Other 0.1%