BlockchainContractValue(for Ethereum)

$BlockchainBase = "Ethereum"

BlockchainContractValue[caddr]

gets the result obtained from a contract containing a Wolfram expression at Ethereum blockchain address caddr.

BlockchainContractValue[caddr,prop]

gets the property prop of the result obtained from a contract containing a Wolfram expression with address caddr.

BlockchainContractValue[caddr,func]

calls the function func of a contract with address caddr.

BlockchainContractValue[caddr,assoc]

calls a contract with address caddr with the properties defined in Association assoc.

Details

  • Gives basic information about an Ethereum contract. By default, it targets the state of the latest block.
  • BlockchainContractValue has option BlockchainBase with default value $BlockchainBase.
  • BlockchainContractValue extracts a contract from the Ethereum blockchain, then runs the specified function in it. It cannot write data to a blockchain; this requires BlockchainTransactionSubmit.
  • BlockchainContractValue[caddr] returns an Association <|"Result"result,"Evaluated"evaluated|>, with the following properties:
  • "Result"output of the evaluation of a Wolfram expression contract
    "Evaluated"specifies whether a contract has been evaluated
  • BlockchainContractValue[caddr,func] calls a non-Wolfram expression contract where func must be a Typed expression defining the name of the function and the output data type.
  • BlockchainContractValue[caddr,assoc] calls a non-Wolfram expression contract with additional parameters where association assoc must have the following property:
  • "Function"Typed expression defining the function to call
  • Additionally, the association assoc can also have the following properties:
  • "Inputs"input parameters of the function to call
    "Sender"address of the sender that is calling the contract
    "BlockNumber"block number associated to a specific state of the blockchain
  • If a particular function does not successfully evaluate in the contract at a given address, BlockchainContractValue returns Missing["NoResult"].

Examples

open allclose all

Basic Examples  (5)

Call the functions name, symbol and decimals, given an address:

Get the result of a contract containing a Wolfram expression that was deployed in the past:

Verify the total supply of OmiseGo tokens using its address:

Check the balance of OMG tokens of a certain holder:

Check the balance of the holder when the block 6000000 was mined:

Check the auction of CryptoKitty with Token ID 883551 during sale period:

Scope  (2)

Evaluated  (1)

Check if a contract has been evaluated:

Result  (1)

Get the result of a contract:

Options  (2)

BlockchainBase  (2)

Mainnet  (1)

Get the total supply of CryptoKitties token using its address:

Testnet  (1)

Get a contract containing a Wolfram expression that was deployed in the past:

Wolfram Research (2019), BlockchainContractValue, Wolfram Language function, https://reference.wolfram.com/language/ref/blockchain/BlockchainContractValue-Ethereum.html.

Text

Wolfram Research (2019), BlockchainContractValue, Wolfram Language function, https://reference.wolfram.com/language/ref/blockchain/BlockchainContractValue-Ethereum.html.

BibTeX

@misc{reference.wolfram_2021_blockchaincontractvalue, author="Wolfram Research", title="{BlockchainContractValue}", year="2019", howpublished="\url{https://reference.wolfram.com/language/ref/blockchain/BlockchainContractValue-Ethereum.html}", note=[Accessed: 21-September-2021 ]}

BibLaTeX

@online{reference.wolfram_2021_blockchaincontractvalue, organization={Wolfram Research}, title={BlockchainContractValue}, year={2019}, url={https://reference.wolfram.com/language/ref/blockchain/BlockchainContractValue-Ethereum.html}, note=[Accessed: 21-September-2021 ]}

CMS

Wolfram Language. 2019. "BlockchainContractValue." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/blockchain/BlockchainContractValue-Ethereum.html.

APA

Wolfram Language. (2019). BlockchainContractValue. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/blockchain/BlockchainContractValue-Ethereum.html