Python web3.eth api调用

这篇具有很好参考价值的文章主要介绍了Python web3.eth api调用。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

Python web3.eth api调用

1.简介

web3.eth api主要提供erc20链内查询方法

2.常用web3.eth API

eth.hashrate
链节点当前时间每秒产生HX数量

'''导入Web3模块'''
from  web3 import Web3


'''连接rpc环境'''
web3 = Web3(Web3.HTTPProvider('http://127.0.0.1:7890'))


web3.eth.hashrate
101

eth.gas_price
查询以wei为单位的当前gas

from  web3 import Web3


'''连接rpc环境'''
web3 = Web3(Web3.HTTPProvider('http://127.0.0.1:7890'))

web3.eth.gas_price
20000000000

eth.blockNumber
查询当前最新区块

from  web3 import Web3


'''连接rpc环境'''
web3 = Web3(Web3.HTTPProvider('http://127.0.0.1:7890'))

web3.eth.blockNumber
2206939

eth.chain_id
查询当前链的链id

from  web3 import Web3


'''连接rpc环境'''
web3 = Web3(Web3.HTTPProvider('http://127.0.0.1:7890'))

web3.eth.chain_id
90

eth.getBalance
查询地址主币数量

from  web3 import Web3


'''连接rpc环境'''
web3 = Web3(Web3.HTTPProvider('http://127.0.0.1:7890'))

web3.eth.getBalance('0xd97F0D2537800BFBb78D9d7Cf087f4A397CbCc3B')

eth.getBlock
根据块高度查询块信息

from web3 import Web3

'''导入geth_poa_middleware'''
from web3.middleware import geth_poa_middleware

web3 = Web3(Web3.HTTPProvider('https://api.avax-test.network/ext/bc/C/rpc'))

'''解决查询块信息数据过长报错问题'''
web3.middleware_onion.inject(geth_poa_middleware, layer=0)

'''查询块信息,不包括完成的交易信息'''
web3.eth.get_block(block_identifier=111,full_transactions=False)
{
'blockExtraData': '0x',
'difficulty': 1, 
'extDataHash': '0x0000000000000000000000000000000000000000000000000000000000000000', 
'proofOfAuthorityData': HexBytes('0xd883010916846765746888676f312e31332e38856c696e757833c10d4e05aed2e565806c09c230894c47daa2d18b278a2905045a55c61516c7'), 
'gasLimit': 89722406, 
'gasUsed': 21000, 
'hash': HexBytes('0x94ec6c0142cbf074457234c7a6fa6661f818a6859efcbae166598b91da81c045'), 
'logsBloom': HexBytes('0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'), 'miner': '0x0100000000000000000000000000000000000000',
'mixHash': HexBytes('0x0000000000000000000000000000000000000000000000000000000000000000'), 
'nonce': HexBytes('0x0000000000000000'), 
'number': 111, 
'parentHash': HexBytes('0x3e5460ee05e93d4025681cede036d5876f60404140915104c10284a563a97dc0'), 
'receiptsRoot': HexBytes('0x056b23fbba480696b65fe5a59b8f2148a1299103c4f57df839233af2cf4ca2d2'),
'sha3Uncles': HexBytes('0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347'), 
'size': 718, 
'stateRoot': HexBytes('0x83f5f7feb20c5716668ff5867729148af33a3e895a607fe495ec5af91d2e78bd'), 
'timestamp': 1600930023,
'totalDifficulty': 111, 
'transactions': [HexBytes('0xa0755b4f899841a58ff675c381994e5e36858920ac9a037f5dbfe8343b055ca8')],
'transactionsRoot': HexBytes('0x659f84685620333b164372d7bee9f103641f64ff45a4f8888de5bf3c70a16d5f'), 
'uncles': []}
     
     
'''查询块信息,包括完成的交易信息'''
web3.eth.get_block(block_identifier=111,full_transactions=False)
{
'blockExtraData': '0x', 
'difficulty': 1, 
'extDataHash': '0x0000000000000000000000000000000000000000000000000000000000000000', 
'proofOfAuthorityData': HexBytes('0xd883010916846765746888676f312e31332e38856c696e757833c10d4e05aed2e565806c09c230894c47daa2d18b278a2905045a55c61516c7'), 
'gasLimit': 89722406,
'gasUsed': 21000, 
'hash': HexBytes('0x94ec6c0142cbf074457234c7a6fa6661f818a6859efcbae166598b91da81c045'), 
'logsBloom': HexBytes('0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'), 
'miner': '0x0100000000000000000000000000000000000000',
'mixHash': HexBytes('0x0000000000000000000000000000000000000000000000000000000000000000'),
'nonce': HexBytes('0x0000000000000000'),
'number': 111, 
'parentHash': HexBytes('0x3e5460ee05e93d4025681cede036d5876f60404140915104c10284a563a97dc0'), 
'receiptsRoot': HexBytes('0x056b23fbba480696b65fe5a59b8f2148a1299103c4f57df839233af2cf4ca2d2'),
'sha3Uncles': HexBytes('0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347'),
'size': 718, 'stateRoot': HexBytes('0x83f5f7feb20c5716668ff5867729148af33a3e895a607fe495ec5af91d2e78bd'),
'timestamp': 1600930023, 
'totalDifficulty': 111, 
'transactions': 
      [
          AttributeDict({
              'blockHash': HexBytes('0x94ec6c0142cbf074457234c7a6fa6661f818a6859efcbae166598b91da81c045'), 
              'blockNumber': 111, 'from': '0x572f4D80f10f663B5049F789546f25f70Bb62a7F',
               'gas': 21000, 
               'gasPrice': 500000000000, 
               'hash': HexBytes('
                   0xa0755b4f899841a58ff675c381994e5e36858920ac9a037f5dbfe8343b055ca8'
                   ), 'input': '0x', 
               'nonce': 92, 
               'to': '0xF1400D80F913a82D12a4d5313c9A6e4a0f56Cbb7',
               'transactionIndex': 0, 
               'value': 200000000000000000, 
               'type': '0x0', 
               'chainId': '0xa869',
               'v': 86262, 
               'r': HexBytes('0x01845c893909c494746f9057ca61f68035c8ea5d0cd0dfc12295458ad38b37c2'), 
               's': HexBytes('0x59b07ac872d42e67e5eff8c47beca688a5c2a316b29426b604d537f9665f61dc')})], 
               'transactionsRoot': HexBytes('0x659f84685620333b164372d7bee9f103641f64ff45a4f8888de5bf3c70a16d5f'), 
               'uncles': []}) 

eth.get_block_transaction_count
根据块高度或者块HX查询块的交易笔数

from web3 import Web3


web3 = Web3(Web3.HTTPProvider('https://api.avax-test.network/ext/bc/C/rpc'))

web3.eth.get_block_transaction_count(111)
1

web3.eth.get_block_transaction_count('0x659f84685620333b164372d7bee9f103641f64ff45a4f8888de5bf3c70a16d5f')
1

eth.get_transaction_receipt
通过交易HX查询交易详情

from web3 import Web3


web3 = Web3(Web3.HTTPProvider('https://api.avax-test.network/ext/bc/C/rpc'))



web3.eth.get_transaction_receipt('0x0e3713a018e74149d00ad0ccf30271af4f9209bc888a34e18f09a4ed6d0032a9')
{
'blockHash': HexBytes('0x1ebff86c8b86ee3acda22bd3d8de51703b02c7fc6b9f56e1461d11c808cf4d99'), 
'blockNumber': 19700539, 
'contractAddress': None, 
'cumulativeGasUsed': 70727, 
'effectiveGasPrice': 25000000000, 
'from': '0xd97F0D2537800BFBb78D9d7Cf087f4A397CbCc3B', 
'gasUsed': 70727, 
'logs': [
    AttributeDict({
        'address': '0xD986fE4b11c73B63d72EFF7207858e5785b2752d', 
        'topics': [
            HexBytes('0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef'), 
            HexBytes('0x0000000000000000000000005fa7d55f978781e8a4b183ca910136f5242e5073'), 
            HexBytes('0x000000000000000000000000d97f0d2537800bfbb78d9d7cf087f4a397cbcc3b')], 
            'data': '0x000000000000000000000000000000000000000000000000000000000006ddd0', 
            'blockNumber': 19700539, 
            'transactionHash': HexBytes('0x0e3713a018e74149d00ad0ccf30271af4f9209bc888a34e18f09a4ed6d0032a9'), 
            'transactionIndex': 0, 
            'blockHash': HexBytes('0x1ebff86c8b86ee3acda22bd3d8de51703b02c7fc6b9f56e1461d11c808cf4d99'), 
            'logIndex': 0, 
            'removed': False
            }), 
    AttributeDict({
        'address': '0x5fA7D55F978781e8A4B183cA910136f5242e5073', 
        'topics': [
            HexBytes('0x0c187edcd92269145104ed94ee618c57f91d45da8dbe5b91a2f950cabb9c6c99')
            ], 
        'data': '0x0000000000000000000000000000000000000000000000000000000000000430000000000000000000000000000000000000000000000000000000000006ddd0', 
        'blockNumber': 19700539, 
        'transactionHash': HexBytes('0x0e3713a018e74149d00ad0ccf30271af4f9209bc888a34e18f09a4ed6d0032a9'), 
        'transactionIndex': 0, 
        'blockHash': HexBytes('0x1ebff86c8b86ee3acda22bd3d8de51703b02c7fc6b9f56e1461d11c808cf4d99'), 
        'logIndex': 1, 
        'removed': False
        })
        ], 
'logsBloom': HexBytes('0x00000000000000000002000200000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000800000000000000800000000000000000008000000000000000000000000000080000000000000000000002000000000000000000000000000000000000000000010000000100210000000000000000040000000000000000000004000000000000000000000000000000000400020000000000000000000000000000000000000000000040000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'), 
'status': 1, 
'to': '0x5fA7D55F978781e8A4B183cA910136f5242e5073', 
'transactionHash': HexBytes('0x0e3713a018e74149d00ad0ccf30271af4f9209bc888a34e18f09a4ed6d0032a9'), 
'transactionIndex': 0, 
'type': '0x0'
}

eth.get_transaction_by_block
根据块高和 下标查询交易详情
block_identifier : 区块高度
Index :第几笔交易

from web3 import Web3


web3 = Web3(Web3.HTTPProvider('https://api.avax-test.network/ext/bc/C/rpc'))

web3.eth.get_transaction_by_block(19700539,0)
{
    'blockHash': HexBytes('0x1ebff86c8b86ee3acda22bd3d8de51703b02c7fc6b9f56e1461d11c808cf4d99'),
    'blockNumber': 19700539,
    'from': '0xd97F0D2537800BFBb78D9d7Cf087f4A397CbCc3B', 
    'gas': 71392, 
    'gasPrice': 25000000000, 
    'hash': HexBytes('0x0e3713a018e74149d00ad0ccf30271af4f9209bc888a34e18f09a4ed6d0032a9'), 
    'input': '0x455c0d4a000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000430', 
    'nonce': 42267, 
    'to': '0x5fA7D55F978781e8A4B183cA910136f5242e5073', 
    'transactionIndex': 0, 
    'value': 0, 
    'type': '0x0', 
    'chainId': '0xa869', 
    'v': 86262, 
    'r': HexBytes('0xd9a79bd6e1971dbf9f6692dec3f1dac6f7bc29c977d9dd75245f857cf7f14a8b'), 
    's': HexBytes('0x0f7e3123938f773cd390403502a725f14da5f4261e06cb4690868f48111528da')
}

eth.wait_for_transaction_receipt
轮询链上交易HX,找到返回交易详情,未找到返回错误
transaction_hash:必填
timeout:非必填,默认两分钟(单位秒)

from web3 import Web3


web3 = Web3(Web3.HTTPProvider('https://api.avax-test.network/ext/bc/C/rpc'))

web3.eth.wait_for_transaction_receipt("0x0e3713a018e74149d00ad0ccf30271af4f9209bc888a34e18f09a4ed6d0032a9")
{
'blockHash': HexBytes('0x1ebff86c8b86ee3acda22bd3d8de51703b02c7fc6b9f56e1461d11c808cf4d99'), 
'blockNumber': 19700539, 
'contractAddress': None, 
'cumulativeGasUsed': 70727, 
'effectiveGasPrice': 25000000000, 
'from': '0xd97F0D2537800BFBb78D9d7Cf087f4A397CbCc3B', 
'gasUsed': 70727, 
'logs': [
    AttributeDict({
        'address': '0xD986fE4b11c73B63d72EFF7207858e5785b2752d', 
        'topics': [
            HexBytes('0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef'), 
            HexBytes('0x0000000000000000000000005fa7d55f978781e8a4b183ca910136f5242e5073'), 
            HexBytes('0x000000000000000000000000d97f0d2537800bfbb78d9d7cf087f4a397cbcc3b')
            ], 
        'data': '0x000000000000000000000000000000000000000000000000000000000006ddd0', 
        'blockNumber': 19700539, 
        'transactionHash': HexBytes('0x0e3713a018e74149d00ad0ccf30271af4f9209bc888a34e18f09a4ed6d0032a9'), 
        'transactionIndex': 0, 'blockHash': HexBytes('0x1ebff86c8b86ee3acda22bd3d8de51703b02c7fc6b9f56e1461d11c808cf4d99'), 
        'logIndex': 0, 
        'removed': False
        }), 
    AttributeDict({
        'address': '0x5fA7D55F978781e8A4B183cA910136f5242e5073', 
        'topics': [
            HexBytes('0x0c187edcd92269145104ed94ee618c57f91d45da8dbe5b91a2f950cabb9c6c99')
            ], 'data': '0x0000000000000000000000000000000000000000000000000000000000000430000000000000000000000000000000000000000000000000000000000006ddd0', 
        'blockNumber': 19700539, 
        'transactionHash': HexBytes('0x0e3713a018e74149d00ad0ccf30271af4f9209bc888a34e18f09a4ed6d0032a9'), 
        'transactionIndex': 0, 
        'blockHash': HexBytes('0x1ebff86c8b86ee3acda22bd3d8de51703b02c7fc6b9f56e1461d11c808cf4d99'), 
        'logIndex': 1, 'removed': False
        })
    ], 
'logsBloom': HexBytes('0x00000000000000000002000200000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000800000000000000800000000000000000008000000000000000000000000000080000000000000000000002000000000000000000000000000000000000000000010000000100210000000000000000040000000000000000000004000000000000000000000000000000000400020000000000000000000000000000000000000000000040000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'), 
'status': 1, 
'to': '0x5fA7D55F978781e8A4B183cA910136f5242e5073', 
'transactionHash': HexBytes('0x0e3713a018e74149d00ad0ccf30271af4f9209bc888a34e18f09a4ed6d0032a9'), 
'transactionIndex': 0, 
'type': '0x0'
}

eth.estimate_gas
预估手续费

from web3 import Web3


web3 = Web3(Web3.HTTPProvider('https://api.avax-test.network/ext/bc/C/rpc'))

web3.eth.estimate_gas({'to': '0xd3CdA913deB6f67967B99D67aCDFa1712C293601', 'from':'0xd3CdA913deB6f67967B99D67aCDFa1712C293601', 'value': 12345})
21000

eth.getTransactionCount
查询nonce


from web3 import Web3


web3 = Web3(Web3.HTTPProvider('https://api.avax-test.network/ext/bc/C/rpc'))

acct =web33.eth.account.privateKeyToAccount(privateKey)

web3.eth.getTransactionCount('0x2837331a85c77138D843250692e0bc3cF7C6B8D5')
3304

eth.account.signTransaction
签名交易

from web3 import Web3


web3 = Web3(Web3.HTTPProvider('https://api.avax-test.network/ext/bc/C/rpc'))

key = 'c89866c1a5541cf325d8b161e37b12926ec093bf85fb8996e41c942f409f8e40'
web3.eth.account.signTransaction(transaction,key)
gas = web3.eth.estimateGas({'from': acct.address, 'to': acct.address, 'value': 1})
tr = {
    'from': acct.address,
    'to': acct.address,
    'nonce': web3.eth.getTransactionCount(acct.address),
    'gasPrice': web3.eth.gas_price,
    'gas': gas,
    'value': 1,
    'data': '',
    'chainId': web3.eth.chainId
}
sig = web3.eth.account.signTransaction(tr, key)
web3.eth.sendRawTransaction(sig.rawTransaction)

SignedTransaction(rawTransaction=HexBytes('0xf869820ce88505d21dba00825208942837331a85c77138d843250692e0bc3cf7c6b8d50180830150f6a0fbc7f8f55f6473479d5c1f2bd0bd10d21e12c7886dd0ec40fc21b060aae07419a04f18d6eea278ef9b611eee8029b1addef1542e07c70c81c7fa1891c63fc61f0c'), hash=HexBytes('0x3c5a61afad21f34ed58493754217e987bc87995fae3e182c68174aa19028d2ec'), r=113883845808617690044871202117477804700152330397016477591268504947707468608537, s=35776602774928587288456033015730457511495579849041010202069064808800658530060, v=86262)

sendRawTransaction
广播交易

from web3 import Web3


web3 = Web3(Web3.HTTPProvider('https://api.avax-test.network/ext/bc/C/rpc'))

key = 'c89866c1a5541cf325d8b161e37b12926ec093bf85fb8996e41c942f409f8e40'
web3.eth.account.signTransaction(transaction,key)
gas = web3.eth.estimateGas({'from': acct.address, 'to': acct.address, 'value': 1})
tr = {
    'from': acct.address,
    'to': acct.address,
    'nonce': web3.eth.getTransactionCount(acct.address),
    'gasPrice': web3.eth.gas_price,
    'gas': gas,
    'value': 1,
    'data': '',
    'chainId': web3.eth.chainId
}
web3.eth.account.signTransaction(tr, key)
b'<Za\xaf\xad!\xf3N\xd5\x84\x93uB\x17\xe9\x87\xbc\x87\x99_\xae>\x18,h\x17J\xa1\x90(\xd2\xec'

eth.account.privateKeyToAccount/from_key
通过私钥返回一个加密对象
address:合约地址
abi :合约abi

from web3 import Web3


web3 = Web3(Web3.HTTPProvider('https://api.avax-test.network/ext/bc/C/rpc'))

'''新版'''
web3.eth.account.from_key('c89866c1a5541cf325d8b161e37b12926ec093bf85fb8996e41c942f409f8e40')
<eth_account.signers.local.LocalAccount object at 0x7fae76d75130>

'''旧版'''
web3.eth.account.privateKeyToAccount('c89866c1a5541cf325d8b161e37b12926ec093bf85fb8996e41c942f409f8e40')
<eth_account.signers.local.LocalAccount object at 0x7fec04f8f160>

.address
换算地址

from web3 import Web3


web3 = Web3(Web3.HTTPProvider('https://api.avax-test.network/ext/bc/C/rpc'))


acct = web3.eth.account.from_key('c89866c1a5541cf325d8b161e37b12926ec093bf85fb8996e41c942f409f8e40')

acct.address
0x2837331a85c77138D843250692e0bc3cF7C6B8D5

.key/privateKey
换算私钥

from web3 import Web3


web3 = Web3(Web3.HTTPProvider('https://api.avax-test.network/ext/bc/C/rpc'))


acct = web3.eth.account.from_key('c89866c1a5541cf325d8b161e37b12926ec093bf85fb8996e41c942f409f8e40')

'''旧'''
acct.privateKey
b'\xc8\x98f\xc1\xa5T\x1c\xf3%\xd8\xb1a\xe3{\x12\x92n\xc0\x93\xbf\x85\xfb\x89\x96\xe4\x1c\x94/@\x9f\x8e@'

'''新版'''
acct.key
b'\xc8\x98f\xc1\xa5T\x1c\xf3%\xd8\xb1a\xe3{\x12\x92n\xc0\x93\xbf\x85\xfb\x89\x96\xe4\x1c\x94/@\x9f\x8e@'

contract
连接合约
eth.contract

from web3 import Web3


web33 = Web3(Web3.HTTPProvider('https://api.avax-test.network/ext/bc/C/rpc'))
contracts = web33.eth.contract(address='0xd0fABb17BD2999A4A9fDF0F05c2386e7dF6519bb', abi='[{"anonymous":false,"inputs":[{"indexed":true,"intern.............')

functions
调用合约中的方法

from web3 import Web3


web3 = Web3(Web3.HTTPProvider('https://api.avax-test.network/ext/bc/C/rpc'))

contracts = web33.eth.contract(address='0xd0fABb17BD2999A4A9fDF0F05c2386e7dF6519bb', abi='[{"anonymous":false,"inputs":[{"indexed":true,"intern.............')

'''通过functions调用合约的transfer方法,打包交易'''
transaction = contracts.functions.transfer(to_address,amount).buildTransaction({
    'from': acct.address,
    'nonce': node,
    'gasPrice': int(web33.eth.gas_price * 1.2)})  # 21000000000
3.其他方法

hex()
bytes转hx格式

hx = b'\xc8\x98f\xc1\xa5T\x1c\xf3%\xd8\xb1a\xe3{\x12\x92n\xc0\x93\xbf\x85\xfb\x89\x96\xe4\x1c\x94/@\x9f\x8e@'
hx.hex()
c89866c1a5541cf325d8b161e37b12926ec093bf85fb8996e41c942f409f8e40

buildTransactions
传递数据生成字典格式文章来源地址https://www.toymoban.com/news/detail-529672.html

from web3 import Web3


web3 = Web3(Web3.HTTPProvider('https://api.avax-test.network/ext/bc/C/rpc'))

contracts = web33.eth.contract(address='0xd0fABb17BD2999A4A9fDF0F05c2386e7dF6519bb', abi='[{"anonymous":false,"inputs":[{"indexed":true,"intern.............')

'''通过functions调用合约的transfer方法,常用数据要生成字典格式,打包交易'''
transaction = contracts.functions.transfer(to_address,amount).buildTransaction({
    'from': acct.address,
    'nonce': node,
    'gasPrice': int(web33.eth.gas_price * 1.2)})  # 21000000000

到了这里,关于Python web3.eth api调用的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包 赞助服务器费用

相关文章

  • python:使用RESTful API(flask)调用python程序传递参数,实现Web端调用python程序

    现有一个用python写的程序(或者是一个或几个的函数接口),需要在Web前端调用python写的函数。如果直接用前端java来调用会很不方便,而且会出现各种麻烦的问题,下面给出如何在web前端调用python的接口。 使用python的RESTful API库将python写的函数封装为Web端可调用的接口,在

    2024年01月20日
    浏览(40)
  • web3.eth.getPendingTransactions() 返回空?

    为什么以下给我一个空的结果? 根据 Geth 源代码,只会显示其 from 字段与您的个人帐户匹配的待处理交易。 代码:go-ethereum/api.go at ead814616c094331915b03edd82d4200a7880178 · ethereum/go-ethereum · GitHub

    2024年02月12日
    浏览(39)
  • 关于web3.js中与交易发送、交易签名、智能合约函数调用相关api的理解

    web3.js中有一些与交易发送、签名、合约函数调用相关的api,初学者(如me)常常搞不清什么情况下应该调用哪个,以及它们之间的区别。现将个人浅见记录如下,备忘。 sendTransaction web3.eth.sendTransaction(transactionObject [, callback]) transactionObject对象设置交易的各种参数(不包括签名r,

    2023年04月09日
    浏览(123)
  • 【web3py】批量创建eth账号

    ____tz_zs 创建可在eth链及其侧链上使用的账号。内容包括:远程节点、本地节点、本地密钥对等。 前言:建议使用方式三的方法,在本地生成密钥对。 使用远程节点(如 Infura)创建帐户时,会报如下错误: web3py the method personal_newAccount does not exist/is not available 。出于安全原因,

    2024年02月02日
    浏览(43)
  • java通过web3j获取ETH交易明细

        我们在项目里面如果想要得到用户的ETH交易明细怎么做呢?有两种方式:    1、直接获取ETH最新块的交易明细。    2、通过块获取用户的交易明细。 废话不多说,直接贴代码看了          下面是项目的相关依赖:

    2024年02月05日
    浏览(49)
  • web3j的基础用法-3ETH交易监听器

    demo简单实现了4种 监听区块 监听所有交易 监听待上链的交易 监听指定合约的交易事件(例如监控大户流转,实现跟单,抛售等后续逻辑) github 地址 https://github.com/jambestwick/we3jdemo

    2024年02月11日
    浏览(45)
  • Tokenview再度升级:全新Web3开发者APIs数据服务体验!

    Tokenview发布全新版本的区块链APIs和数据服务平台,为开发者打造更强大、更便捷的开发体验! 此次升级,我们整合了开发者使用习惯以及Tokenview产品优势。我们深知对于开发者来说,时间是非常宝贵的,因此我们努力提供一个高效的页面结构,帮助您更快速地找到所需的信

    2024年02月11日
    浏览(48)
  • 如何使用 NFTScan NFT API 在 PlatON 网络上开发 Web3 应用

    PlatON 是由万向区块链和矩阵元主导开发的面向下一代的全球计算架构,创新性的采用元计算框架 Monad 和基于 Reload 覆盖网络的同构多链架构,其愿景是成为全球首个提供完备隐私保护能力的运营服务网络。它提供计算、存储、通讯服务,并提供算力、算法、数据等众多基础资

    2024年02月02日
    浏览(34)
  • 如何使用 NFTScan NFT API 在 Base 网络上开发 Web3 应用

    Base 是 Coinbase 使用 OP Stack 开发的最新以太坊第 2 层(L2)网络,用于解决以太坊等主要区块链面临的可扩展性和成本挑战。Coinbase 将其描述为“安全、低成本、对开发人员友好的以太坊 L2,旨在将下一个 10 亿用户带入 Web3”。BASE 被设计为一个标准的、模块化的、rollup 不可知

    2024年01月21日
    浏览(44)
  • Web3 的开发者,如何评估以及选择调用链上数据的解决方案

    FP是链上数据分析平台以及数据处理基础设施,使命是让链上数据分析以及使用随手可得。目前,Footprint 从 22 条公链上收集、解析和清理数据,把无语义以及无序的链上数据,转化成让用户能使用无代码拖放界面、SQL等多种形式构建图表以及仪表盘。除了提供链上原始数据,

    2024年02月02日
    浏览(52)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包