record the pits encountered in contract development
first, the transaction has not been broadcast
Problem: The contract is able to read and write data on the online compiler remix, but fails to write the data on the local private chain and does not have any error prompts.
For example:
> bikeshared.userRentStart.sendTransaction ("0x34ecdbb13d4e58d5c7aa749feaf5c0f660a3d896", 1, {from:user1})
===>
"0x05ba935316952c5d2f727bf665faad6535b7296761d5b06f6e57165885f57bbb"
view:
> Txpool.inspect
{
pending: {
0x1b0e770c80eae3bf5a9d85f970c20fcf02b2b63c: {
61: " 0x3f232c4d9b685754be7ecaf2ea0da154431aeb9a:0 Wei + 90000 gasx18000000000 wei "
}
},
queued: {}
}< c14/>:
{
pending: {},
queued: {}
}
===> But the data has not been modified
Reason: Gas and gasprice are too small to drive to the bottom of the big success
> bikeshared.userRentStart.sendTransaction ("0x34ecdbb13d4e58d5c7aa749feaf5c0f660a3d896", 1, {from:user1, gas : 500000, gasprice:3800000000000})
"0x81edba1d917aaa8ea8c9cbfe885dfeec49f81a6a6041b3a4cec40589be8746a9"
Second, BigNumber
Problem: When trying to read a contract in App.js the data times are wrong
Uncaught bignumber error:new BigNumber () not a base number
Reference: Here
There may be a reason: the node is not synchronized. The same thing happens when you point to an address that does not actually implement the API. If the fallback function does not return a string, you will encounter trouble parsing the string. third, Invalid JSON RPC response:undefined
Reference: Here
Cause: Personal.unlock may be used in the code. The personal parameter is not added when the private chain is started
Workaround: Start command-"Personal,db,eth,net,web3,miner"//Add Personal