BlockchainTransaction (for bloxberg)
BlockchainTransaction[assoc]
represents a bloxberg blockchain transaction built from the components in the association assoc.
Details
- Gives a symbolic representation of a bloxberg 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 berg - 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 berg 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 deploying contract.
- 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 bloxberg transactions. To specify this network, use the "BlockchainBase" value inside the required association or the BlockchainBase option.
Examples
open all close allBasic Examples (2)
Create a bloxberg transaction object to send bergs:
BlockchainTransaction[<|"TransactionCount" -> 58,
"GasPrice" -> Quantity[0, "bergs"], "Address" -> "2cdFffD8B15BDa30b4573B1b22Dce2d23ac86D26",
"BlockchainBase" -> "Bloxberg"|>]Create a bloxberg transaction object and specify the gas limit:
BlockchainTransaction[<|"TransactionCount" -> 58,
"GasPrice" -> Quantity[0, "bergs"], "GasLimit" -> 21000,
"Address" -> "2cdFffD8B15BDa30b4573B1b22Dce2d23ac86D26",
"Amount" -> Quantity[1, "Gbrox"],
"BlockchainBase" -> "Bloxberg"|>]Scope (5)
Plain-text Solidity contract (2)
Build a contract using plain Solidity code in a blockchain transaction:
solidityCode = "pragma solidity ^0.4.23;
contract Test{
function sum(uint256 a, uint256 b) public pure returns (uint256)
{
return a+b;
}
}
";BlockchainTransaction[<|"TransactionCount" -> 58,
"GasPrice" -> Quantity[0, "bergs"],
"Contract" -> solidityCode,
"BlockchainBase" -> "Bloxberg"|>]Build a contract using plain Solidity code with multiple contract definitions:
solidityCode = "pragma solidity ^0.4.23;
contract Test2{
function sum(uint256 a, uint256 b) public pure returns (uint256){
return a+b;
}
}
contract Test is Test2{
function main(uint256 a,uint256 b) public pure returns (uint256){
return sum(a,b);
}
}";BlockchainTransaction[<|"TransactionCount" -> 59,
"GasPrice" -> Quantity[0, "bergs"],
"Contract" -> <|"SourceCode" -> solidityCode, "Main" -> "Test"|>,
"BlockchainBase" -> "Bloxberg"|>]Solidity contract file (1)
Build a contract using a Solidity file:
Import[File["ExampleData/sample.sol"]]BlockchainTransaction[<|"BlockchainBase" -> "Bloxberg", "TransactionCount" -> 60, "Contract" -> File["ExampleData/sample.sol"], "GasPrice" -> Quantity[0, "bergs"]|>]Build a contract using a Solidity file with multiple contract definitions:
Import[File["ExampleData/sample2.sol"]]BlockchainTransaction[<|"BlockchainBase" -> "Bloxberg", "TransactionCount" -> 61, "Contract" -> <|"Source" -> File["ExampleData/sample2.sol"], "Main" -> "Test"|>, "GasPrice" -> Quantity[0, "bergs"]|>]Build a contract using multiple Solidity files:
Import[File["ExampleData/sample3.sol"]]Import[File["ExampleData/sample4.sol"]]BlockchainTransaction[<|"BlockchainBase" -> "Bloxberg", "TransactionCount" -> 61, "Contract" -> <|"Source" -> {File["ExampleData/sample4.sol"], File["ExampleData/sample3.sol"]}, "Main" -> "Test4"|>, "GasPrice" -> Quantity[0, "bergs"]|>]Compiled Solidity contract (1)
Build a contract using compiled code and its application binary interface:
bytecode = "608060405234801561001057600080fd5b506040516104503803806104508339810180604052810190808051820192919060200180518201929190602001805190602001909291905050508260009080519060200190610060929190610087565b508160019080519060200190610077929190610087565b508060028190555050505061012c565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106100c857805160ff19168380011785556100f6565b828001600101855582156100f6579182015b828111156100f55782518255916020019190600101906100da565b5b5090506101039190610107565b5090565b61012991905b8082111561012557600081600090555060010161010d565b5090565b90565b6103158061013b6000396000f300608060405260043610610057576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063047fc9aa1461005c57806306fdde031461008757806354fd4d5014610117575b600080fd5b34801561006857600080fd5b506100716101a7565b6040518082815260200191505060405180910390f35b34801561009357600080fd5b5061009c6101ad565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100dc5780820151818401526020810190506100c1565b50505050905090810190601f1680156101095780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561012357600080fd5b5061012c61024b565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561016c578082015181840152602081019050610151565b50505050905090810190601f1680156101995780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b60025481565b60008054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156102435780601f1061021857610100808354040283529160200191610243565b820191906000526020600020905b81548152906001019060200180831161022657829003601f168201915b505050505081565b60018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156102e15780601f106102b6576101008083540402835291602001916102e1565b820191906000526020600020905b8154815290600101906020018083116102c457829003601f168201915b5050505050815600a165627a7a72305820116f53a6040b598029b8580eb96cf331f11fc8a7ba722618dfd5dd8df8601f9e0029";abi = "[{\"constant\":true,\"inputs\":[],\"name\":\"supply\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"name\",\"outputs\":[{\"name\":\"\",\"type\":\"string\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"version\",\"outputs\":[{\"name\":\"\",\"type\":\"string\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"name\":\"_name\",\"type\":\"string\"},{\"name\":\"_version\",\"type\":\"string\"},{\"name\":\"_supply\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"}]";BlockchainTransaction[<|"BlockchainBase" -> "Bloxberg", "TransactionCount" -> 62, "Contract" -> <|"ABI" -> abi, "ByteCode" -> bytecode, "Parameters" -> {"hello", "world", 10005}|>, "GasPrice" -> Quantity[0, "bergs"]|>]General contract call (1)
Create a transaction to do a value update over a state variable in a deployed contract:
contractAddress = "D3201000dDa9de4f04F53B50DcfEc9Af3FBA25a7";BlockchainTransaction[<|"BlockchainBase" -> "Bloxberg", "TransactionCount" -> 65, "Address" -> contractAddress, "FunctionCall" -> <|"Function" -> Typed["setResult", {"string"} -> {}], "Inputs" -> "ONE"|>, "GasPrice" -> Quantity[0, "bergs"]|>]Options (1)
Applications (1)
Create a bloxberg BlockchainTransaction:
bloxbergTX = BlockchainTransaction[<|"BlockchainBase" -> "Bloxberg", "TransactionCount" -> 1, "Address" -> "2cdFffD8B15BDa30b4573B1b22Dce2d23ac86D26", "Amount" -> Quantity[1, "Gbrox"], "GasPrice" -> Quantity[0, "bergs"]|>]bloxbergTXSigned = BlockchainTransactionSign[bloxbergTX, PrivateKey[Association["Type" -> "EllipticCurve", "CurveName" -> "secp256k1",
"PublicCurvePoint" ->
{27112075690151519677987005437167591271987576467999908152870704903750742697008,
35340190558986655200725209493311762384517889396024615752 ... 00,
"Compressed" -> False, "PublicByteArray" ->
ByteArray[
"BDvw5BsUAEh0WY7CgBHAK7sPRruT/rr3xpRgF8gws+QwTiHWyeDrK7K9R5em/dkrhBgnuVzVxgAu9FWlEguegoo="],
"PrivateByteArray" -> ByteArray["v9Uxg5+nffM+nupc+AIqiN1/qBisfHUlPZsiJpZYauw="]]]]Send the signed transaction to the bloxberg blockchain:
bloxbergTXSubmitted = BlockchainTransactionSubmit[bloxbergTXSigned]Verify the transaction using its "TransactionID":
bloxbergTXSubmitted["TransactionID"]txdata = BlockchainTransactionData[bloxbergTXSubmitted["TransactionID"], BlockchainBase -> "Bloxberg"]//DatasetRelated Guides
History
Introduced in 2020 (12.1)
Text
Wolfram Research (2020), BlockchainTransaction, Wolfram Language function, https://reference.wolfram.com/language/ref/blockchain/BlockchainTransaction-bloxberg.html.
CMS
Wolfram Language. 2020. "BlockchainTransaction." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/blockchain/BlockchainTransaction-bloxberg.html.
APA
Wolfram Language. (2020). BlockchainTransaction. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/blockchain/BlockchainTransaction-bloxberg.html
BibTeX
@misc{reference.wolfram_2026_blockchaintransaction, author="Wolfram Research", title="{BlockchainTransaction}", year="2020", howpublished="\url{https://reference.wolfram.com/language/ref/blockchain/BlockchainTransaction-bloxberg.html}", note=[Accessed: 13-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_blockchaintransaction, organization={Wolfram Research}, title={BlockchainTransaction}, year={2020}, url={https://reference.wolfram.com/language/ref/blockchain/BlockchainTransaction-bloxberg.html}, note=[Accessed: 13-June-2026]}