What is proper cmd. line invocation of the EOS cmd. "cleos set contract?" - eos

From the documentation at https://developers.eos.io/eosio-cpp/docs/token-tutorial:
cleos set contract eosio.token build/contracts/eosio.token -p eosio.token#active
But from the documentation at https://developers.eos.io/eosio-cleos/reference#cleos-set-contract:
set contract (below are parameters:)
Positional Parameters:
account TEXT - The account to publish a contract for
wast-file TEXT - The file containing the contract WAST or WASM
abi-file TEXT - The ABI for the contract
So which is it? I'm confused b/c the documentatin is inconsistent.

Documentation is outdated. You can run cleos set contract help to see latest docs. It would result to:
account — the account to publish a contract for.
contract-dir — contract directory.
wast-file — the file containing the contract WAST or WASM.
abi-file — the ABI of the contract.
Also, if your wast/abi files have the same name as folder, you my specify only contract-dir.
"How to Create and Deploy Your Own EOS Token" might be helpful.

Related

Chainlink Automation upKeep not working. checkUpKeep is not calling performUpKeep

Our Dapp will have an NFT Auction functionality, which we are trying to automate 100% using chainlink. The auction winner will get the NFT and the Previous owner will get the highest Bid, Platform will get a small cut as well.
To do that, we are using CHainlink Keeper/Automation. I've set the checkUpKeep & performUpKeep, both are working fine when I'm doing everything manually. But when I am registering an upKeep for automaton.
When I input the deployed contract's address into the register upkeep box, it says Unable to verify if this is an Automation compatible contract. Why this warning?
How do I make the contract Automation compatible contract?
checkUpKeep is working good:
If I pass this performData into performUpKeep everything will work fine.
Code/Contracts: https://mumbai.polygonscan.com/address/0x7e2DA19C130cb3B483FA7f17C45c70716ABF5Fe8
Chainlink upKeep: https://automation.chain.link/mumbai/21891159634677518530356555981285976030474691922841692133624884405593696766700
Pls help, Thanks.
Unable to verify if this is an Automation compatible contract usually stems from a contract that is not verified on the block explorer. The contract you linked is verified and if you create an automation with it everything is good
Your checkUpKeep function does return true when supplied with the input you show(checkData). However, you have the checkData set to 0x in your automation.
With that input, it returns false.
You will need to change the checkData to match your screenshot.

DeployedBytecode doesn't match

so I encountered a weird issue with deploying bytecodes via a deployer contract. On 1 of 5 deployed contracts via the same compilation round & deployment flow I ended having a different deployedBytecode (but same bytecode) as with my original truffle compiled source. Therefore I can't get it verified. The issue seems that the address of the deployer contract is part of the deployedBytecode (while on my local file it is the null address). The issue is also only for 1 contract, while all 5 contracts share the same code (especially around the deployer address mentioned inside the contract.
So here i.e. is the deployer contract (+ verified source code):
https://polygonscan.com/address/0xd54716865c58d11e7c39c3cf634d9e919c0c6cce#code
I deployed my contract (SignerVaultV1.sol) via that tx:
https://polygonscan.com/tx/0x4d6e3a002b448e675ba6a2374737d4eaf0e18b163a57a66c09109ba332c8c5e3
The bytecode of it is exactly the same as on my local file, but if the deployedBytecodes are compared, 3 changes can be seen: Diff between online vs offline deployedBytecode (I can't post pics yet^^)
The difference in it is the address of the deployer contract (d54716865c58d11e7c39c3cf634d9e919c0c6cce). But like I said, the deployerContract delivered multiple contracts, all are correct, only this one is having that issue and I cant figure it out why.
I personally would like to get that contract verified without having to redeploy it (and maybe rund into the same issue...) I tried already to alter the source code to match the online deployedBytecode, but it seems also a harsh idea :D
Well after testing different ways, I dont honestly why, but sending a verification request via hardhat got it working... I couldn't manually verify or via truffle, but hardhat seems to know the magic for the last contract :)

No job show up in Runs page while trying to run a Chainlink node locally

I am trying to fulfil requests on my local test chainlink node on rinkeby (following https://docs.chain.link/docs/fulfilling-requests/) but can't see any job runs appear on my operator ui.
The Oracle contract is at 0xA66f738a4688A9E51c2c6FF901CC3B11ce31AE6C
The ATestnetConsumer contract is at 0x977129EE2f404F4327A2A60C5fD9E57890D85FD0
My job toml screenshot below
Have confirmed my .env that it is running the rinkeby wss url from infura and the chain is 4 and the link token contract address is 0x01BE23585060835E02B77ef475b0Cc51aA1e0709
My node wallet has ETH and LINK. Both the contracts have Link too (but no ETH).
I run the setFulfillmentPermission function in remix with my Node wallet address and true
When I execute the requestEthereumPrice function with my oracle address and job id, I can see the LINK being sent by the ATestnetConsumer contract to the Oracle contract but no job run gets created in my local Chainlink node.
Confirming that the job hasn't run, I get the 0 value when I run the currentPrice function on ATestnetConsumer.
Can anyone please point me to where I am going wrong? Thanks in advance!
Finally got it to work. Posting my two findings as I do think the documentation needs an update to account for these.
The external job id in the Jobs screen on the Operator UI has dashes in them. To use them in the ATestnetConsumer contract you need to remove the dashes (so 0e84f38985eb4edb98c2e2a09b589666 and not 0e84f389-85eb-4edb-98c2-e2a09b589666).
The direct request toml doesn't seem to work as is. I had to append allowunrestrictednetworkaccess="true" to the fetch section so it becomes
fetch [type="http" method=GET url="$(decode_cbor.get)" allowunrestrictednetworkaccess="true"]

What is the "eosio" account re:EOS blockchains?

When configuring and installing an EOS blockchain, you're required to use the "eosio" account as the block producing account or blocks aren't signed. I haven't been able to find much info. however about this pseudo account as it appears to come w/the software by default.
From EOSIO documentation, the "eosio" account is an authorizing account, used to bootstrap EOSIO nodes. But is it stored someplace, or just the default "root" account for EOS blockchains?
You even use this account to create new accounts.
My question is, where is its private key? Is this the key set in the genesis.json file? Can I use another account to configure my blockchain? I would imagine so b/c you specify it at the cmd. line, otherwise the parameter wouldn't be needed.
I'm just frustrated by the lack of documentation surrounding EOS and kindly request help from the community.
UPDATE: 7/13/2018
I changed the "producer-name" to another value but then the blockchain doesn't sign transactions and it sits idle. This is why I'm confused about "eosio." Its key is configured in the config.ini but it doesn't appear that you can change the "producer-name," which is fine, but then why have a "-p" cmd. line parameter? It's just not making sense to me.
its private key is stored at config.ini
# Tuple of [public key, WIF private key] (may specify multiple times) (eosio::producer_plugin)
private-key = ["EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV","5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3"]
The second value is the private key.
In addition I think that you can use another account to configure your blockchain . EOSIO is just the testing account .
So i suppose that you can use another block producer if you use another producer name and account with different keys at config.ini
Check this : https://medium.com/coinmonks/test-4fbd38fdc4e8 chapter 4

Google pubsub into HTTP triggered cloud function?

Is it possible to trigger an HTTP cloud function in response to a pubsub message?
When editing a subscription, google makes it possible to push the message to an HTTPS endpoint, but for abuse reasons one has to be able to prove that you own the domain in order to do this, and of course you can't prove that you own google's own *.cloudfunctions.net domain which is where they get deployed.
The particular topic I'm trying to subscribe to is a public one, projects/pubsub-public-data/topics/taxirides-realtime. The answer might be use a background function rather than HTTP triggered, but that doesn't work for different reasons:
gcloud functions deploy echo --trigger-resource projects/pubsub-public-data/topics/taxirides-realtime --trigger-event google.pubsub.topic.publish
ERROR: gcloud crashed (ArgumentTypeError): Invalid value 'projects/pubsub-public-data/topics/taxirides-realtime': Topic must contain only Latin letters (lower- or upper-case), digits and the characters - + . _ ~ %. It must start with a letter and be from 3 to 255 characters long.
This seems to indicate this is only permitted on topics I own, which is a strange limitation.
It is possible to publish from a pub/sub topic to a cloud function. I was looking for a way to publish messages from a topic in project A to a function in project B. This was not possible with a regular topic trigger, but it is possible with http-trigger. Overall steps to follow:
Creata a http-triggered function in project B.
Create a topic in project A.
Create a push subscription on that topic in project A.
Domain verification
Push subscription
Here we have to fill in three things: the endpoint, the audience and the service account under which the function runs.
Push Endpoint: https://REGION-PROJECT_ID.cloudfunctions.net/FUNC_NAME/ (slash at end)
Audience: https://REGION-PROJECT_ID.cloudfunctions.net/FUNC_NAME (no slash at end)
Service Account: Choose a service account under which you want to send the actual message. Be sure the service account has the "roles/cloudfunctions.invoker" role on the cloud function that you are sending the messages to. Since november 2019, http-triggered functions are automatically secured because AllUsers is not set by default. Do not set this property unless you want your http function to be public!
Domain verification
Now you probably can't save your subscription because of an error, that is because the endpoint is not validated by Google. Therefore you need to whitelist the function URL at: https://console.cloud.google.com/apis/credentials/domainverification?project=PROJECT_NAME.
Following this step will also bring you to the Google Search Console, where you would also need to verify you own the endpoint. Sadly, at the time of writing this process cannot be automated.
Next we need to add something in the lines of the following (python example) to your cloud function to allow google to verify the function:
if request.method == 'GET':
return '''
<html>
<head>
<meta name="google-site-verification" content="{token}" />
</head>
<body>
</body>
</html>
'''.format(token=config.SITE_VERIFICATION_CODE)
Et voila! This should be working now.
Sources:
https://github.com/googleapis/nodejs-pubsub/issues/118#issuecomment-379823198,
https://cloud.google.com/functions/docs/calling/http
Currently, Cloud Functions does not allow one to create a function that receives messages for a topic in a different project. Therefore, specifying the full path including "projects/pubsub-public-data" does not work. The gcloud command to deploy a Cloud Function for a topic expects the topic name only (and not the full resource path). Since the full resource path contains the "/" character, it is not a valid specification and results in the error you see.
The error you are getting seems to be that you are misspelling something in the gcloud command you are issuing.
ERROR: gcloud crashed (ArgumentTypeError): Invalid value 'projects/pubsub-public-data/topics/taxirides-realtime': Topic must contain only Latin letters (lower- or upper-case), digits and the characters - + . _ ~ %. It must start with a letter and be from 3 to 255 characters long
Are you putting a newline character in the middle of the command?