Chainlink Node Operator Create Job, Unknown Task Type "ETHTX" - chainlink

I am a Chainlink beginner attempting to set up a Chainlink node on Rinkeby. I have the node running and can access the operator GUI. When I attempt to set up a job (following the documentation here: https://docs.chain.link/docs/fulfilling-requests/) I copy and paste the TOML blob into the field, update my oracle address.
type = "directrequest"
schemaVersion = 1
name = "Get > Uint256"
contractAddress = "updated_addr"
maxTaskDuration = "0s"
observationSource = """
decode_log [type="ethabidecodelog"
abi="OracleRequest(bytes32 indexed specId, address requester, bytes32 requestId, uint256 payment, address callbackAddr, bytes4 callbackFunctionId, uint256 cancelExpiration, uint256 dataVersion, bytes data)"
data="$(jobRun.logData)"
topics="$(jobRun.logTopics)"]
decode_cbor [type="cborparse" data="$(decode_log.data)"]
fetch [type="http" method=GET url="$(decode_cbor.get)"]
parse [type="jsonparse" path="$(decode_cbor.path)" data="$(fetch)"]
multiply [type="multiply" input="$(parse)" times=100]
encode_data [type="ethabiencode" abi="(uint256 value)" data="{ \\"value\\": $(multiply) }"]
encode_tx [type="ethabiencode"
abi="fulfillOracleRequest(bytes32 requestId, uint256 payment, address callbackAddress, bytes4 callbackFunctionId, uint256 expiration, bytes32 data)"
data="{\\"requestId\\": $(decode_log.requestId), \\"payment\\": $(decode_log.payment), \\"callbackAddress\\": $(decode_log.callbackAddr), \\"callbackFunctionId\\": $(decode_log.callbackFunctionId), \\"expiration\\": $(decode_log.cancelExpiration), \\"data\\": $(encode_data)}"
]
submit_tx [type="ethtx" to="updated_addr" data="$(encode_tx)"]
decode_log -> decode_cbor -> fetch -> parse -> multiply -> encode_data -> encode_tx -> submit_tx
"""
When I attempt to create the job, I get the following error message:
UnmarshalTaskFromMap: unknown task type: "ethtx"
I did some digging in their documentation to see if they had changed the task name, and found this link to this specific task, and it seems to match the example code above.
https://docs.chain.link/docs/jobs/task-types/eth-tx/
I also attempted "eth tx", "eth_tx" and also ethtx without quotes without luck. I assume this has been depreciated and the documentation has not caught up.
Thank you for your time.

It's ethtx, you should just update your Chainlink Node to version 1.0.0 or above

Related

Job error on a multi-chain chainlink node version:1.2.0

I have a chainlink node running on two chains evmChainID=4(rinkeby) and evmChainID=80001(Mumbai-polygon)
I have deployed a TestnetConsumer contract on Mumbai which fetches the latest Ethereum price.
The Jobspec created for the consuming contract is as follows:
type = "directrequest"
schemaVersion = 1
name = "Get > Uint256-MUMBAI-POLYGON"
externalJobID = "1d77fe57-fd0c-4ee7-ba6e-e5e40a0e72c4"
maxTaskDuration = "0s"
contractAddress = "0x-my-oracle-contract"
evmChainID = "80001"
minIncomingConfirmations = 0
observationSource = """
decode_log [type="ethabidecodelog"
abi="OracleRequest(bytes32 indexed specId, address requester, bytes32 requestId, uint256 payment, address callbackAddr, bytes4 callbackFunctionId, uint256 cancelExpiration, uint256 dataVersion, bytes data)"
data="$(jobRun.logData)"
topics="$(jobRun.logTopics)"]
decode_cbor [type="cborparse" data="$(decode_log.data)"]
fetch [type="http" method=GET url="$(decode_cbor.get)"]
parse [type="jsonparse" path="$(decode_cbor.path)" data="$(fetch)"]
multiply [type="multiply" input="$(parse)" times=100]
encode_data [type="ethabiencode" abi="(uint256 value)" data="{ \\"value\\": $(multiply) }"]
encode_tx [type="ethabiencode"
abi="fulfillOracleRequest(bytes32 requestId, uint256 payment, address callbackAddress, bytes4 callbackFunctionId, uint256 expiration, bytes32 data)"
data="{\\"requestId\\": $(decode_log.requestId), \\"payment\\": $(decode_log.payment), \\"callbackAddress\\": $(decode_log.callbackAddr), \\"callbackFunctionId\\": $(decode_log.callbackFunctionId), \\"expiration\\": $(decode_log.cancelExpiration), \\"data\\": $(encode_data)}"
]
submit_tx [type="ethtx" to="0x-my-oracle-contract" data="$(encode_tx)" evmChainID="80001"]
decode_log -> decode_cbor -> fetch -> parse -> multiply -> encode_data -> encode_tx -> submit_tx
"""
The job runs keep getting success and error alternatively. The error happens because the node tries to send the txn using the key bound to evmChainID=4 as shown in the screenshot.
Errors:
while creating transaction: cannot send transaction on chain ID 80001; eth key with address 0xED3413f20d7F16B5E8934aFf935FD763a3Bd63Cf is pegged to chain ID 4: task run failed
It seems its an error related to some default config. Please help. Thanks
The expectation is the Job spec written specific for evmChainID=80001 will use the key bound to the same evmChainID. The keys were created with CLI.

Encoding byte array for performUpkeep() in Chainlink Keepers

We have this code below which will encode a uint256 array into a byte array.
For some reason, performUpkeep() will be successful in Remix IDE but not using Hardhat.
function checkUpkeep(bytes calldata checkData) external view override returns (bool, bytes memory) {
bool flag = false;
uint256 counter = 0;
uint256[] memory numbers = new uint256[](10);
for (uint256 i = 0; i < 10; i+=2) {
numbers[counter++] = i;
}
bytes memory checkData = abi.encode(numbers);
return (flag, checkData);
}
function performUpkeep(bytes calldata performData) external override {
uint256[] memory numbers = abi.decode(performData, (uint256[]));
console.log("The first number is:", numbers[0]);
}
The end goal here is to pass data through to performUpkeep succesfully.
The performUpkeep() function takes an argument of type bytes. It then decodes that argument into an array of uint256. Before passing data to performUpkeep() in Hardhat, you must encode the array of uint256 you wish to pass as an argument according to the standard EVM encoding format.
To do so in Hardhat (Javascript) you can use the ethers.js library to access the defaultAbiCoder object and encode your arguments using it. An example can be seen below
let abiCoder = ethers.utils.defaultAbiCoder;
let dataEncoded = abiCoder.encode([ "uint[]"], [[ 1, 2, 3]]);
await keeperContract.performUpkeep(dataEncoded)

Cannot control volume level with prosody in google Cloud Text-to-Speech

SSML Volume property has no effect on the output audio
Following is the ssml
<speak>
<prosody volume = "+0dB"> This is a sentence with volume 10 For GOOGLE. </prosody>
<s><prosody volume = "+6dB"> This is a sentence with volume 6 For GOOGLE. </prosody></s>
<s><prosody volume = "+24dB"> This is a sentence with volume +24 For GOOGLE. </prosody></s>
<s><prosody volume = "+48dB"> This is a sentence with volume +48 For GOOGLE.</prosody></s> <s><prosody volume = "+196dB"> This is a sentence with volume +196 For GOOGLE.</prosody></s>
</speak>
And here is a sample code
String ssml = $"<speak><prosody volume = \"+0dB\"> This is a sentence with volume 10 For GOOGLE.</prosody>" +
$" <s><prosody volume = \"+6dB\"> This is a sentence with volume 6 For GOOGLE.</prosody></s>" +
$" <s><prosody volume = \"+24dB\"> This is a sentence with volume +24 For GOOGLE.</prosody></s>" +
$" <s><prosody volume = \"+48dB\"> This is a sentence with volume +48 For GOOGLE.</prosody></s>" +
$" <s><prosody volume = \"+196dB\"> This is a sentence with volume +196 For GOOGLE.</prosody></s>" +
$"</speak>";
Dubb(ssml);
public static void Dubb(string ssml)
{
var client = TextToSpeechClient.Create();
// The input to be synthesized, can be provided as text or SSML.
var input = new SynthesisInput
{
Ssml = ssml
};
// Build the voice request.
var voiceSelection = new VoiceSelectionParams
{
LanguageCode = "en-US",
SsmlGender = SsmlVoiceGender.Female
};
// Specify the type of audio file.
var audioConfig = new AudioConfig
{
AudioEncoding = AudioEncoding.Linear16
};
// Perform the text-to-speech request.
var response = client.SynthesizeSpeech(input, voiceSelection, audioConfig);
// Write the response to the output file.
using (var output = File.Create("output.wav"))
{
response.AudioContent.WriteTo(output);
}
}
I expected that the volume will increase in each line, but it doesn't.
I tried this
<speak>
<prosody volume = "+0dB"> This is a sentence with volume 10 For GOOGLE. </prosody>
<s><prosody volume = "+6dB"> This is a sentence with volume 6 For GOOGLE. </prosody></s>
<s><prosody volume = "+24dB"> This is a sentence with volume +24 For GOOGLE. </prosody></s>
<s><prosody volume = "+48dB"> This is a sentence with volume +48 For GOOGLE.</prosody></s> <s><prosody volume = "+196dB"> This is a sentence with volume +196 For GOOGLE.</prosody></s>
</speak>
On the TTS UI and it does work as expected.
From there you can export it to JSON (maybe it helps you).
{
"audioConfig": {
"audioEncoding": "LINEAR16",
"pitch": 0,
"speakingRate": 1
},
"input": {
"ssml": "<speak> <prosody volume = \"+0dB\"> This is a sentence with volume 10 For GOOGLE. </prosody> <s><prosody volume = \"+6dB\"> This is a sentence with volume 6 For GOOGLE. </prosody></s> <s><prosody volume = \"+24dB\"> This is a sentence with volume +24 For GOOGLE. </prosody></s> <s><prosody volume = \"+48dB\"> This is a sentence with volume +48 For GOOGLE.</prosody></s> <s><prosody volume = \"+196dB\"> This is a sentence with volume +196 For GOOGLE.</prosody></s> </speak>"
},
"voice": {
"languageCode": "en-US",
"name": "en-US-Standard-A"
}
}

Get name of Bluetooth device from address

Given a Bluetooth device address (represented by a SOCKADDR_BTH struct), is there a way to get the name of the device? using getnameinfo returns EAI_FAMILY ("The sa_family member of socket address structure pointed to by the sa parameter is not supported."):
// {B62C4E8D-62CC-404b-BBBF-BF3E3BBB1374}
DEFINE_GUID(g_guidServiceClass, 0xb62c4e8d, 0x62cc, 0x404b, 0xbb, 0xbf,
0xbf, 0x3e, 0x3b, 0xbb, 0x13, 0x74);
SOCKADDR_BTH SockAddrBthServer;
SockAddrBthServer.addressFamily = AF_BTH;
SockAddrBthServer.serviceClassId = g_guidServiceClass;
SockAddrBthServer.port = 0;
SockAddrBthServer.btAddr = //Filled with Bluetooth device address
char hostname[NI_MAXHOST] = {0};
char servInfo[NI_MAXSERV] = {0};
int ret = getnameinfo((struct sockaddr *) &SockAddrBthServer,
sizeof(SOCKADDR_BTH), hostname, NI_MAXHOST, servInfo, NI_MAXSERV, 0);
Use BluetoothGetDeviceInfo function to get remote device's name. Also you can resolve during discovering.
Please note that device name of NEW device may be empty if you try to read it right after discovering.
The best way is to subscribe for WM_DEVICECHANGE message (refer to MSDN WM_DEVICECHANGE and Bluetooth).

Printing the physical address space of shared memory

In C program I got 2 programs one to store a string in a shared memory and the other program is to print the same string via accessing the shared memory.
program 1->
printf("\n SENDER ADDRESS");
printf("\nTHE ADDRESS IS %p",addr1);
printf("\nENTER THE MESSAGE:");
scanf("%s",addr1);
printf("\nMESSAGE STORED IN %p IS %s",addr1,addr1);
program->2
I am having the same text body in program 2 . **BUT IT IS PRINTING THE LOGICAL ADDRESS. HENCE IN THE OUTPUT IAM GETTING 2 DIFFERENT LOGICAL ADRESS. BUT INSTEAD OF THAT IF I WANT TO HAVE SAME PHYSICAL ADDRESS(TO SATISFY THE COLLEGE PROFFESSOR)HOW CAN I DO.**
PLEASE HELP....
PROGRAM 1:
#include<sys/types.h>
#include<string.h>
#include<sys/ipc.h>
#include<sys/shm.h>
#include<stdio.h>
main()
{
key_t key;
int shmid;
char* addr1;
key = ftok("/home/tamil/myc/pws.c",'T');
shmid = shmget(key,128*1024,IPC_CREAT|SHM_R|SHM_W);
addr1 = shmat(shmid,0,0);
printf("\nIPC SHARED MEMORY");
printf("\n SENDER ADDRESS");
printf("\nTHE ADDRESS IS %p",addr1);
printf("\nENTER THE MESSAGE:");
scanf("%s",addr1);
printf("\nMESSAGE STORED IN %p IS %s",addr1,addr1);
}
PROGRAM 2:
#include<sys/types.h>
#include<string.h>
#include<sys/ipc.h>
#include<sys/shm.h>
#include<stdio.h>
main()
{
int shmid;
char* addr1;
key_t key;
key = ftok("/home/tamil/myc/pws.c",'T');
shmid = shmget(key,128*1024,SHM_R|SHM_W);
addr1 = shmat(shmid,0,0);
printf("\nIPC SHARED MEMORY");
printf("\n SENDER ADDRESS");
printf("\nTHE ADDRESSS IS %p",addr1);
printf("\nMESSAGE STORED IN %p IS %s",addr1,addr1);
}
output:
tamil#ubuntu:~/myc$ cc shmget.c
tamil#ubuntu:~/myc$ ./a.out
IPC SHARED MEMORY
SENDER ADDRESS
**THE ADDRESS IS **0xb786c000****
ENTER THE MESSAGE:helloworld
MESSAGE STORED IN **0xb786c000** IS helloworldtamil#ubuntu:~/myc$ cc shmget2.c
tamil#ubuntu:~/myc$ ./a.out
IPC SHARED MEMORY
SENDER ADDRESS
**THE ADDRESSS IS **0xb7706000****
MESSAGE STORED IN **0xb7706000** IS helloworldtamil#ubuntu:~/myc$
Dumping 2 MB of shared mem on Linux.
dd if=/dev/shm/stuff_here of=myshm.dmp bs=1024 count=2048
Might have to mount it first in fstab.

Resources