I am trying to create a private network so that I can start testing my Solidity code. However, when starting the a geth private network with geth --rpc but I then run into an error for an invalid response. {"jsonrpc":"2.0","error":{"code":-32600,"message":"EOF"}} when checking localhost:8545.
I don't think it matters, but my genesis.json file is
{
"nonce": "0x0000000000000042", "timestamp": "0x0",
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"extraData": "0x0", "gasLimit": "0x8000000", "difficulty": "0x400",
"mixhash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"coinbase": "0x3333333333333333333333333333333333333333", "alloc": { }}
I have also tried creating a test network with testrpc with just the command testrpc but here the localhost:8545 returns a parsing error {"jsonrpc": "2.0", "id": null, "error": {"message": "Parse error", "code": -32700}}.
What is the JSON that I am sending because it seems to be incorrectly written?
Thanks
It's hard to tell what exactly you are trying, but the JSON RPC endpoint of geth requires a JSON command, for instance try to query the web3 version with the following request:
{
"method": "web3_clientVersion",
"params": []
}
It complains because you do not provide any request, i.e., running a plain testrpc command.
But inbetween the lines I read that you are testing your solidity code. Have you had a look at the wonderful browser solidity?
Related
Finally deployed a self-hosted Sourcegraph, v3.39.1. I'm running on Google Compute Engine on a Container Optimized OS VM. Got everything working except I'm having difficulty getting SMTP set up though Google Workspace's smtp-relay. When I run a sendTestEmail command, I get back an opaque error:
{
"data": {
"sendTestEmail": "Failed to send test email: EOF"
}
}
Here is a redacted snippet of my config:
"email.address": "myemailaddress#mydomain.com",
"email.smtp": {
"authentication": "PLAIN",
"domain": "mydomain.com",
"username": "myemailaddress#mydomain.com",
"password": "REDACTED",
"host": "smtp-relay.gmail.com",
"port": 587
}
For a quick smoke test, I ran netcat (nc smtp-relay.gmail.com 587) from the container and did sent EHLO mydomain.com. The smtp-relay responded with a "at your service" so I assume that worked. Any one have any other tips? Any logs I can check? (I didn't see anything obvious, but I'm new to Sourcegraph)
I'm trying to update policy in one of my API gateway using AWS cli and this is for automation purposes. When I try with the policy json with command, it's succeeded, but when I try to execute it with pointing a json file it's giving errors,
aws apigateway update-rest-api --rest-api-id cyasdze47d --patch-operations op=replace,path=/policy,value="file://foo.json"
error :
An error occurred (BadRequestException) when calling the UpdateRestApi operation: Invalid policy document. Please check the policy syntax and ensure that Principals are valid.
foo.json
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": "*",
"Action": "execute-api:Invoke",
"Resource": "arn:aws:execute-api:eu-west-1:123345455:cyxxxxxd/test1/*"
}
]
}
Can anyone help me on how to replace existing policy with json file using AWS cli ?
Thanks
You must strinfigy your policy first as shown in the docs.
strinfigied=$(jq tostring foo.json)
aws apigateway update-rest-api --rest-api-id cyasdze47d --patch-operations op=replace,path=/policy,value=${strinfigied}
I am sending the following valid JSON as a message via MQTT to a device :
{
"devices": [
{
"known": true,
"local": false,
"eep": "MSC_V3_PRESSAC_20",
"id": "01:96:23:83",
"O_nominalVoltage": 120
}
],
"uuid": "821ca781-dd98-4531-8391-19d4e4da2c96"
}
but I receive the following error back :
"Handling command: org.json.JSONException: Expected a ',' or '}' at character 62 of {devices:[{known:true,local:false,eep:MSC_V3_PRESSAC_20,id:01:96:23:83,O_nominalVoltage:120}],uuid:821ca781-dd98-4531-8391-19d4e4da2c96}"
}
Can anyone see anything wrong with this? I don't understand why there is a problem with character 62.
For more information, I am sending the message via the mosquitto_pub command when publishing to an MQTT topic on a remote device.
My device is running Java code which uses the Java Paho libraries. I am using the AWS IoT MQTT broker.
Pretty much as stated in the title, after running truffle test I get this:
TestMetacoin
1) "before all" hook: prepare suite
Contract: MetaCoin
✓ should put 10000 MetaCoin in the first account
2) should call a function that depends on a linked library
> No events were emitted
✓ should send coin correctly (6078ms)
2 passing (6s)
2 failing
1) TestMetacoin "before all" hook: prepare suite:
Error: Intrinsic gas too low
at Object.InvalidResponse (/usr/lib/node_modules/truffle/node_modules/truffle-contract/node_modules/web3/lib/web3/errors.js:35:16)
at /usr/lib/node_modules/truffle/node_modules/truffle-contract/node_modules/web3/lib/web3/requestmanager.js:86:36
at XMLHttpRequest.request.onreadystatechange (/usr/lib/node_modules/truffle/node_modules/web3/lib/web3/httpprovider.js:119:13)
at XMLHttpRequestEventTarget.dispatchEvent (/usr/lib/node_modules/truffle/node_modules/xhr2/lib/xhr2.js:64:18)
at XMLHttpRequest._setReadyState (/usr/lib/node_modules/truffle/node_modules/xhr2/lib/xhr2.js:354:12)
at XMLHttpRequest._onHttpResponseEnd (/usr/lib/node_modules/truffle/node_modules/xhr2/lib/xhr2.js:509:12)
at IncomingMessage.<anonymous> (/usr/lib/node_modules/truffle/node_modules/xhr2/lib/xhr2.js:469:24)
at endReadableNT (_stream_readable.js:974:12)
at _combinedTickCallback (internal/process/next_tick.js:74:11)
at process._tickDomainCallback (internal/process/next_tick.js:122:9)
2) Contract: MetaCoin should call a function that depends on a linked library:
AssertionError: Library function returned unexpected function, linkage may be broken: expected 0 to equal 20000
at test/metacoin.js:25:14
at process._tickDomainCallback (internal/process/next_tick.js:129:7)
My genesis block is as follows:
{
"nonce": "0x0000000000000042",
"difficulty": "0x4000",
"alloc": {
"0xfd0ceb7965a0e4c3146c1f901fbab9668653af6b": {
"balance": "325406000000000"
}
},
"mixhash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"coinbase": "0xfd0ceb7965a0e4c3146c1f901fbab9668653af6b",
"etherbase" : "0xfd0ceb7965a0e4c3146c1f901fbab9668653af6b",
"timestamp": "0x00",
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"extraData": "0x",
"gasLimit": "0x3d0900"
}
And my truffle.js is like this:
module.exports = {
networks: {
development: {
host: "localhost",
port: 8545,
network_id: "*", // Match any network id
gas: 1000000
}
}
};
I fail to understand what is wrong with gas at these settings. Even if noone has the exact answer, some additional explanation of the gas limits (not the gas itself) would be helpful.
I ended up changing genesis block gasLimit to
"gasLimit": "0x2FEFD800",
config for homestead block to 10 (apparently otherwise there are issues when working with geth):
"config": {
"homesteadBlock": 10
},
and truffle.js gas setting to 5000000.
Tests pass.
i am trying to create a policy for group by using cli-input-json providing json as input to the cli command.
The command is
aws iam put-group-policy --cli-input-json file://D:\\json\\demo\\json
grpPolicy_testpolicy1.json
which gives following error
A client error (MalformedPolicyDocument) occurred when calling the PutGroupPolicy operation: The policy is not in the valid JSON format.
The content of json file at D:\json\demo\json
grpPolicy_testpolicy1.json is
{
"GroupName": "testgroup11",
"PolicyName": "testpolicy11",
"PolicyDocument": "file://D:\\json\\policypermission.txt"
}
The content of policy document file at D:\json\
policypermission.txt is
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "uploadandgetfromS3",
"Effect": "Allow",
"Action": [
"s3:CreateBucket",
"s3:CreateObject",
"s3:GetObject",
"s3:GetObjectAcl",
"s3:ListAllMyBuckets",
"s3:ListBucket",
"s3:PutBucketAcl",
"s3:PutObject",
"s3:PutObjectAcl",
"rds:DescribeDBLogFiles",
"rds:DownloadDbLogFilePortion"
],
"Resource": "*"
}
]
}
i have verified all the json files for the validity of json, still aws cli says that the policy document is malformed.
i have also created and attached the above said policy by using normal cli command to confirm the validity of the policy document and that has worked fine.
{
"GroupName": "testgroup11",
"PolicyName": "testpolicy11",
"PolicyDocument": "file://D:\\json\\policypermission.txt"
}
While this would make sense conceptually, I think the AWS Command Line Interface (AWS CLI) doesn't support inline/nested references to URLs like file:// here, rather only as a command line argument, e.g.:
aws iam put-group-policy --cli-input-json file://D:\\json\\demo\\json \
grpPolicy_testpolicy1.json --policy-document file://D:\\json\\policypermission.txt
This works, because command line arguments take precedence over those specified as CLI Input JSON Parameters. However, once you do not specify the overriding --policy-document, the JSON parser trips over the inline PolicyDocument element, where it expects an inline JSON object but encounters the URL file://D:\\json\\policypermission.txt instead.