Interacting with Blockchains

Christian Pasquel

Read

BlockchainData

BlockchainData[]//Dataset

BlockchainBase

BlockchainData[BlockchainBase->"Ethereum"]//Dataset

BlockchainData[BlockchainBase-> {"ARK","Devnet"}]//Dataset

BlockchainBlockData

$BlockchainBase="Bitcoin"

BlockchainBlockData[123123]//Dataset

BlockchainBlockData["0000000000000000001240ca996608e85efbb813d1feeada0165d2fa855b31b3"]//Dataset

BlockchainBlockData[{1,123456,"0000000000000000001240ca996608e85efbb813d1feeada0165d2fa855b31b3"}]//Dataset

BlockchainBlockData[123123,"TimeMined"]

Now-%

BlockchainBlockData[123123,{"TimeMined","PreviousBlockHash"}]

Sound[SoundNote[#,#*0.05,"NewAge"]&/@Take[Flatten[ToCharacterCode[BlockchainBlockData[300000,"TransactionList",BlockchainBase-> "Bitcoin"]]]-60,100]]

Sound[SoundNote[#,#*0.05,"NewAge"]&/@Take[Flatten[ToCharacterCode[BlockchainBlockData[5000000,"TransactionList",BlockchainBase-> "Ethereum"]]]-60,100]]

BlockchainTransactionData

tx=RandomChoice[BlockchainBlockData[-1,"TransactionList"]]

BlockchainTransactionData[tx]//Dataset

BlockchainTransactionData[tx,"TotalOutput"]

FullForm[%]

CurrencyConvert[(QuantityPrefix[1.3857136`, "฿" , bitcoins, "Bitcoins"]),"USDollars"]

CurrencyConvert[(QuantityPrefix[1.3857136`, "฿" , bitcoins, "Bitcoins"]),"PeruvianSoles"]

BlockchainTransactionData["6e269faccf4791e8c0a67be5c29cf888a6dc10f5217ad9ca993f61b0bf22c84e",{"Recipient","Amount","Fee"},BlockchainBase-> "ARK"]

BlockchainAddressData

BlockchainTransactionData["a93bfdff6679bc38cfdcd16cc38e34513fa2ee97186864e22cac5723864cde13",{"Sender","Receiver"},BlockchainBase->"Ethereum"]

addr=First[%]

$BlockchainBase="Ethereum"

BlockchainAddressData[addr]//Dataset

BlockchainAddressData["b1690C08E213a35Ed9bAb7B318DE14420FB57d8C"]//Dataset

BlockchainTokenData

BlockchainTokenData["Tronix"]//Dataset

BlockchainTokenData["CK"]//Dataset

BlockchainTokenData["CryptoKitties"]//Dataset

BlockchainTokenData["ERC20",BlockchainBase->"Ethereum"]//Dataset

BlockchainTokenData["ERC721",BlockchainBase->"bloxberg"]//Dataset

BlockchainTokenData[<|"Name"->"Tronix","TimeInterval"->{(DateObject["Hour: ""Mon 30 Jul 2018 3 pm""GMT"-5.`, DateObject[{2018,7,30,15},"Hour","Gregorian",-5.`]]),(DateObject["Hour: ""Mon 30 Jul 2018 10 pm""GMT"-5.`, DateObject[{2018,7,30,22},"Hour","Gregorian",-5.`]])}|>,BlockchainBase->{"Ethereum","Mainnet"},MaxItems->10]//Dataset

tokens=BlockchainTokenData[<|"Name"->All|>,{"Name","TransfersCount"}];

WordCloud[SortBy[tokens,Last]]

BlockchainContractValue

BlockchainAddressData["f230b790E05390FC8295F4d3F60332c93BEd42e2",BlockchainBase->"Ethereum"]//Dataset

BlockchainContractValue["f230b790E05390FC8295F4d3F60332c93BEd42e2",Typed["name","string"],BlockchainBase-> {"Ethereum","Mainnet"}]

BlockchainContractValue["f230b790E05390FC8295F4d3F60332c93BEd42e2",Typed["symbol","string"],BlockchainBase-> {"Ethereum","Mainnet"}]

Write

keys=GenerateAsymmetricKeyPair["ARK"]

BlockchainKeyEncode[PublicKey[],"Address",BlockchainBase->{"ARK", "Devnet"}]

BarcodeImage[%,"QR"]

ARKAddress="DPsqg2Zenenao8eXLD2gyBfxmTre1kKQNf"

$BlockchainBase={"ARK","Devnet"}

BlockchainKeyEncode[PublicKey[],"Address"]

BlockchainAddressData[ARKAddress]//Dataset

tx=BlockchainTransaction[<|
"BlockchainBase"->{"ARK","Devnet"},
"Recipient"->"DQo4Yu4g4AoHQAwED1CVh6ukbX6Kn8WZ4P",
"Amount"->5000000|>]

txSigned=BlockchainTransactionSign[BlockchainTransaction[],PrivateKey[]]

BlockchainTransactionSubmit[txSigned]

txSubmitted=%

txSubmitted["TransactionID"]

$BlockchainBase

BlockchainTransactionData[txSubmitted["TransactionID"]]//Dataset