1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
| var Contract = require('web3-eth-contract'); Contract.setProvider(RPC_ENDPOINT); const contract = new Contract(ABI_arr, Contract_address)
contract.methods.name().call()
const rawTransaction = { from: "账户地址", gasPrice: web3.utils.toHex(20 * 1e9), gasLimit: web3.utils.toHex(210000), to: "合约地址", value: 0x0, data: contract.methods.transfer("账户地址", web3.utils.toHex(1000)).encodeABI(), nonce: web3.utils.toHex(transactionCount) } const signedTx = await eth.accounts.signTransaction(rawTransaction, "账户的private key"); const res = await eth.sendSignedTransaction(signedTx.rawTransaction);
|