sendfrom rpc 통신 node.js
const express= require('express');
const app = express();
const request = require('request');
app.get('/sendfrom',(req,res)=>{
    // headers={"Content-type": "application/json"};
    headers={"Content-type": "text/plain"};
    body=`{"method":"sendfrom","params":["[email protected]","g2wynHtq89Lx8TMVPQmhYhpgDMhhWZmj8e",1]}`;
    //params:["보내는 계정 이름","받는 지갑 주소",보내는 코인의 양]
    const USER=process.env.RPC_USER || 'groot1';
    const PASS = process.env.RPC_PASSWORD || '1234';
    const RPCPORT= process.env.RPC_PORT || 3010;
    const options={
        url:`http://groot1:[email protected]:3010`,
        method:"POST",
        headers,
        body
    }
    let txid;
    const callback = (err,response,data)=>{
        console.log('aaaaaa')
         if(err==null && response.statusCode ==200) {
            console.log('data')
            txid=JSON.parse(data)
            res.send(txid.result)
         }else{
             console.log('err')
            console.log(err)
             res.send(err)
         }
    }
    request(options,callback);
    
})
app.get('/',(req,res)=>{
    res.send('hello world')
})
app.listen(3000,()=>{
    console.log('server port 3000')
})수업시간에는 "Content-type": "application/json"으로 headers를 구성했는데
getbalance는 이게 되는 반면, sendfrom은 에러가 났다. 그 이유를 찾기위해 윈도우로 채굴을 감행해야했다 ㅠㅠㅠ;
headers구성을 다르게 해주니 되었다.....
정말 삽질을 많이 했는데 ㅠㅠㅠㅠㅠ
원래 리눅스에서도 했는데 너무 힘들었다... 결과가 잘 안나오는것 같아서 힘들었다.
콘솔창에는 이렇게 나온다.

화면은 이렇게 나온다.

qt는 이렇게 뜬다.

이로써 sendfrom 은 자기 자신에게만 쓸 수 있다는 것을 알 수 있다. 
Author And Source
이 문제에 관하여(sendfrom rpc 통신 node.js), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://velog.io/@nara7875/sendfrom-rpc-통신-node.js저자 귀속: 원작자 정보가 원작자 URL에 포함되어 있으며 저작권은 원작자 소유입니다.
                                
                                
                                
                                
                                
                                우수한 개발자 콘텐츠 발견에 전념
                                (Collection and Share based on the CC Protocol.)