BlockchainTransaction(for Ethereum)

$BlockchainBase = "Ethereum"

BlockchainTransaction[assoc]

represents an Ethereum blockchain transaction built from the components in the association assoc.

Details

  • Gives a symbolic representation of an Ethereum blockchain transaction; it does not submit the transaction, and the transaction is not signed.
  • BlockchainTransaction[][prop] gives the value of the property prop for the transaction.
  • The following elements must be given:
  • "TransactionCount"number of transactions associated with the account
    "GasPrice"price per gas unit in wei
  • Additionally, the "GasLimit" element can be given. By default, it is computed internally:
  • "GasLimit"maximum amount of gas for execution
  • When doing a transfer, the following elements must be given:
  • "Address"address to send the transfer
    "Amount"amount of wei to transfer
  • When deploying a contract, the following element must be given:
  • "Contract"contract to deploy in the transaction
  • When using plain Solidity code, the contract must be a string containing the code, as in "Contract""code".
  • When using plain Solidity code with multiple contracts, "Contract" must be specified as an association <|"SourceCode""code","Main""name"|>, where "Main" is the name of the contract to be deployed.
  • When providing a file containing Solidity code, the contract must be a File, as in "Contract"->File[].
  • When providing a file containing Solidity code with multiple contracts, "Contract" must be specified as an association <|"Source"File[],"Main""name"|>, where "Main" is the name of the contract to be deployed.
  • When providing multiple files containing Solidity code, "Contract" must be specified as an association <|"Source"{file1,file2,},"Main""name"|>, where {file1,file2,} is a list of File expressions from which file1 will be compiled, and "Main" is the name of the contract to be deployed.
  • When using compiled Solidity code, "Contract" must be specified as an association of the form <|"ByteCode""hexstring","ABI""spec"|>, where "ABI" is the Application Binary Interface.
  • Additionally, when providing an association for "Contract", an extra "Parameters" property can be given to define the initialization parameters of the contract to be deployed.
  • When deploying an automatically executed Wolfram Language expression in an Ethereum transaction, the following elements can be given:
  • "WolframExpression"a expression to evaluate when harvested
    "WolframExpressionReference"a reference to an expression to be retrieved and evaluated
  • Ethereum transactions containing Wolfram Language expressions can only be deployed to the Ethereum testnet.
  • When calling a contract, the following elements must be given:
  • "Address"address of the contract
    "FunctionCall"function call to make in the contract
  • The "FunctionCall" element can be an Association or a Typed expression.
  • In case "FunctionCall" is a Typed expression, it must define the function name.
  • In case "FunctionCall" is an Association expression, the following property must be given:
  • "Function"Typed expression defining the function to call
  • The following additional properties can also be given to the "FunctionCall" association:
  • "Inputs"input parameters of the function to call
    "Sender"address of the sender that is calling the contract
  • The following additional properties can also be requested from a BlockchainTransaction object:
  • "Signed"whether the transaction has been digitally signed
    "MessageHash"hash of the unsigned transaction
    "RawTransaction"serialized transaction
    "TransactionID"transaction ID
  • BlockchainTransaction can represent Ethereum mainnet (default) and testnet (Sepolia) transactions. To specify these networks, use the "BlockchainBase" value inside the required association or the BlockchainBase option.

Examples

open allclose all

Basic Examples  (2)

Create an Ethereum transaction object to send ethers:

Create an Ethereum transaction object and specify the gas limit:

Scope  (7)

Plain-Text Solidity Contract  (2)

Build a contract using plain Solidity code in a blockchain transaction:

Build a contract using plain Solidity code with multiple contract definitions:

Solidity Contract File  (1)

Build a contract using a Solidity file:

Build a contract using a Solidity file with multiple contract definitions:

Build a contract using multiple Solidity files:

Compiled Solidity Contract  (1)

Build a contract using compiled code and its application binary interface:

Wolfram Language Expression   (2)

Build a contract using a Wolfram Language expression. This expression will be evaluated by Wolfram servers:

Build a contract using a Wolfram Language expression referenced by an external storage object. The Wolfram servers will evaluate the reference:

General Contract Call   (1)

Create a transaction to do a value update over a state variable in a deployed contract:

Options  (2)

BlockchainBase  (2)

Mainnet  (1)

Create a mainnet transaction:

Testnet  (1)

Create a testnet transaction:

Applications  (1)

Create an Ethereum BlockchainTransaction:

Sign the transaction object:

Send the signed transaction to the Ethereum blockchain:

Verify the transaction using its "TransactionID":

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

Text

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

CMS

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

APA

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

BibTeX

@misc{reference.wolfram_2024_blockchaintransaction, author="Wolfram Research", title="{BlockchainTransaction}", year="2019", howpublished="\url{https://reference.wolfram.com/language/ref/blockchain/BlockchainTransaction-Ethereum.html}", note=[Accessed: 22-November-2024 ]}

BibLaTeX

@online{reference.wolfram_2024_blockchaintransaction, organization={Wolfram Research}, title={BlockchainTransaction}, year={2019}, url={https://reference.wolfram.com/language/ref/blockchain/BlockchainTransaction-Ethereum.html}, note=[Accessed: 22-November-2024 ]}