eosasia / ping-eos Goto Github PK
View Code? Open in Web Editor NEWImplementing ping between EOS / React.js
Implementing ping between EOS / React.js
Error in the 4.2 version:
nodeos:
766000ms thread-0 producer_plugin.cpp:942 produce_block ] Produced block 000013d060b69f55... #5072 @ 2018-06-03T16:12:46.000 signed by eosio [trxs: 0, lib: 5071, confirmed: 0] 766480ms thread-0 http_plugin.cpp:369 handle_exception ] FC Exception encountered while processing chain.push_transaction: 3010010 packed_transaction_type_exception: Invalid packed transaction Invalid packed transaction {} thread-0 chain_plugin.cpp:722 push_transaction pivot != std::string::npos: No delimiter in string, cannot determine type: EOSK8teWzsJrL9WbE8MssinTjLaAmG19vUwDaXjc8fbnVRAcqdr81URWHVPAtyw1iC92E5smJbcuEM18tpNTna192nvB1177N {"str":"EOSK8teWzsJrL9WbE8MssinTjLaAmG19vUwDaXjc8fbnVRAcqdr81URWHVPAtyw1iC92E5smJbcuEM18tpNTna192nvB1177N"} thread-0 signature.cpp:20 parse_base58 Failed to deserialize variant {"variant":{"compression":"none","transaction":{"expiration":"2018-06-03T16:13:43","region":0,"ref_block_num":5064,"ref_block_prefix":2015999601,"max_net_usage_words":0,"max_kcpu_usage":0,"delay_sec":0,"context_free_actions":[],"actions":[{"account":"ping.ctr","name":"ping","authorization":[{"actor":"tester","permission":"active"}],"data":"000000005c95b1ca"}]},"signatures":["EOSK8teWzsJrL9WbE8MssinTjLaAmG19vUwDaXjc8fbnVRAcqdr81URWHVPAtyw1iC92E5smJbcuEM18tpNTna192nvB1177N"]}} thread-0 abi_serializer.hpp:516 from_variant 766500ms thread-0 producer_plugin.cpp:942 produce_block ] Produced block 000013d1987f9def... #5073 @ 2018-06-03T16:12:46.500 signed by eosio [trxs: 0, lib: 5072, confirmed: 0]
this is part of frontend/src/index.jsx content.
const EOS_CONFIG = {
contractName: "child.acnt", // Contract name
contractSender: "child.acnt", // User executing the contract (should be paired with private key)
clientConfig: {
keyProvider: ['5KQVzEFg4PbDNtCbdhbfgwfaqQYPNzhjna3ZCm5AzrFZCpeoccg','5KcHE3HF4zAecKWFxBiizG3KBPpkBxbbMDAn1HPeHQZecy69bZy'], // Your private key
httpEndpoint: 'http://127.0.0.1:8888' // EOS http endpoint
}
}
'5KQVzEFg4PbDNtCbdhbfgwfaqQYPNzhjna3ZCm5AzrFZCpeoccg','5KcHE3HF4zAecKWFxBiizG3KBPpkBxbbMDAn1HPeHQZecy69bZy' are owner_private_key and active_private_key respectively.
why nodeos show STD Exception encountered while processing chain.get_code: unknown key
?
what should I do?
i get this error when i try to run the sample application
message: "{"code":500,"message":"Internal Service Error","error":{"code":3120010,"name":"packed_transaction_type_exception","what":"Invalid packed transaction","details":[{"message":"Invalid packed transaction","file":"chain_plugin.cpp","line_number":432,"method":"push_transaction"},{"message":"pivot != std::string::npos: No delimiter in string, cannot determine type: EOSKYLnPtagGZ5SLmhErpqHcmLHXTQtVmPbv3wMc1rq8mvvTTypMoYMnwNYSxEG1jUW8KqXS9fkhwtAofZCpfXf6rSUXvD53R","file":"signature.cpp","line_number":20,"method":"parse_base58"},{"message":"Failed to deserialize variant","file":"abi_serializer.hpp","line_number":444,"method":"from_variant"}]}}"
when do action "npm start",
It is show error
Unexpected end of input at 1:2578
npm ERR! "^3.1.7","esprima":"~4.0.0","esprima-fb":"~14001.1.0-dev-harmony-fb","
Failed to load http://127.0.0.1:8888/v1/chain/get_code: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8080' is therefore not allowed access. If an opaque
response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
apigen.js:118 api error => http://127.0.0.1:8888/v1/chain/get_code {"account_name":"ping.ctr"} TypeError: Failed to fetch
Thank you for your excellent tutorial. I have a issue with the frontend, in the index.js I don't know how add private keys into the keyprovider.
my keyprovider looks like this:
keyProvider:[[
"EOS5BtL6cQsVzMhuujppUTKmVWFY6EYLrDfdraaQnA2BBJYCrxCCb",
"5KCk5d5pAuack1NiqSxTiJsrAiE6wgLxYHGo6JACpMuFJb39NeG"
],[
"EOS5GQ7PHBvEPCRWhiA3rNDVrrLYtvoxh7Vvnska9xa4RjkyZvUbH",
"5J38vcyy1CVR9NeAArrZfeAUzjyGEAzJZmJ7paLHqJYKQo6hQC9"
],[
"EOS5cDrz8eHLHwW94QSpSwwLFphUCRKYiCyoZ8CoySm6EVMwHCDBE",
"5Jjvnup2dqUGsQ7KhvJgYyohL8jUv9zcWcECHiWyZuALxXZWT5C"
],[
"EOS5sGH7Rdch9qHaXLA98NRg1qPrH7UobrZBsdS5Nt7Qd2uJVH8G3",
"5HvCUxF4AVkePfAewWjXyqiApMQ3Yy6NzGKJE2w8WQvtEGvZLqa"
],[
"EOS6AT4kMkkiYhDgUeJ8YxupBRWHzu9pLPPicqLnpPN7qViT5TFiU",
"5J5RHaY31VLcZoFUhjfSudyArKu6WWFbdmocaFYojsehENAFKRQ"
],[
"EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV",
"5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3"
],[
"EOS8MHfK4v7UGHrYKq1beFbrxv8LegKvgaXk4xEcK1ynBRGDqbAvU",
"5KELKQohNbdoJ2MRmHPQh6ef7tFWSpBQ1gCpcjkNKER7hWczwCZ"
]
], // Your private ke
when i click the ping button I got this problem:
apigen.js:115 AssertionError {name: "AssertionError", actual: false, expected: true, operator: "==", message: "expecting public or private keys from keyProvider", …}
Thank you for your help!
when I run "node pingPong.js" ,error occured!
Details are as follows:
{ AssertionError [ERR_ASSERTION]: Invalid public key
at Object.PublicKey (/Users/changlingyi/node_modules/eosjs/node_modules/eosjs-ecc/lib/key_public.js:24:9)
at /Users/changlingyi/node_modules/eosjs/lib/index.js:191:30
at Array.map ()
at Object.signProvider (/Users/changlingyi/node_modules/eosjs/lib/index.js:185:17)
at /Users/changlingyi/node_modules/eosjs/lib/write-api.js:625:23
at /Users/changlingyi/node_modules/eosjs/lib/write-api.js:771:7
at /Users/changlingyi/node_modules/eosjs/node_modules/eosjs-api/lib/exported-helpers.js:69:7
at /Users/changlingyi/node_modules/eosjs/node_modules/eosjs-api/lib/exported-helpers.js:79:7
at callback (/Users/changlingyi/node_modules/eosjs/node_modules/eosjs-api/lib/process-args.js:70:9)
at callback (/Users/changlingyi/node_modules/eosjs/node_modules/eosjs-api/lib/apigen.js:99:9)
generatedMessage: false,
name: 'AssertionError [ERR_ASSERTION]',
code: 'ERR_ASSERTION',
actual: false,
expected: true,
operator: '==' }
The following is the content of my pingPong.js file.
let EOS = require('eosjs')
eos = EOS.Localnet({
keyProvider:['PW5Jj6BExXZ5cYd6VpKktgEugoF9CGWEjbmgh9am27XsFMuorLffi'],
httpEndpoint:'http://127.0.0.1:8888'
})
eos.contract('child.acnt').then((contract) => {
contract.ping("child.acnt",{authorization:['child.acnt']}).then((res) => {
console.log(res)
})
})
ping smart contract is set to EOS blockchanin, and when I use command line to interact to ping smart contract is ok!
when I run "node pingPong.js" , EOS nodeos didn't receive any message
What's the wrong? what should I do?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.