當前位置: 首頁>>代碼示例>>Python>>正文


Python Web3.toChecksumAddress方法代碼示例

本文整理匯總了Python中web3.Web3.toChecksumAddress方法的典型用法代碼示例。如果您正苦於以下問題:Python Web3.toChecksumAddress方法的具體用法?Python Web3.toChecksumAddress怎麽用?Python Web3.toChecksumAddress使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在web3.Web3的用法示例。


在下文中一共展示了Web3.toChecksumAddress方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: setGreeting

# 需要導入模塊: from web3 import Web3 [as 別名]
# 或者: from web3.Web3 import toChecksumAddress [as 別名]
        greeting = 'Hello';
    }

    function setGreeting(string _greeting) public {
        greeting = _greeting;
    }

    function greet() constant returns (string) {
        return greeting;
    }
}
"""

# above is deployed here:
contract_address = '0x31bd34ef7dbd96a20098b7a5aaf67a45bbef2726'
contract_address = Web3.toChecksumAddress(contract_address)

# here is the ABI of the contract:
abi = """
[
	{
		"constant": false,
		"inputs": [
			{
				"name": "_greeting",
				"type": "string"
			}
		],
		"name": "setGreeting",
		"outputs": [],
		"payable": false,
開發者ID:oberstet,項目名稱:scratchbox,代碼行數:33,代碼來源:web3_with_twisted.py

示例2: open

# 需要導入模塊: from web3 import Web3 [as 別名]
# 或者: from web3.Web3 import toChecksumAddress [as 別名]
import json
from web3.auto import w3
from web3 import Web3

with open('build/contracts/Kudos.json') as f:
    abi = json.load(f)['abi']

checksummed = Web3.toChecksumAddress('0xe7bed272ee374e8116049d0a49737bdda86325b6')

kudos = w3.eth.contract(address=checksummed, abi=abi)

bugsquasher = dict(name='bugsquasher',
                   description='exterminator',
                   rareness=1234,
                   price=50000,
                   numClonesAllowed=3
                   )

collabmachine = dict(name='collaborationmachine',
                     description='plays nice with others',
                     rareness=1234,
                     price=50000,
                     numClonesAllowed=3
                     )

designstar = dict(name='designstar',
                  description='makes nice things',
                  rareness=1234,
                  price=50000,
                  numClonesAllowed=3
                  )
開發者ID:vovyl,項目名稱:gitcoin-erc721,代碼行數:33,代碼來源:test_kudos.py


注:本文中的web3.Web3.toChecksumAddress方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。