입금주소 생성

이더리움 2018. 11. 30. 10:46

입금주소 생성


web3 = new Web3(new Web3.providers.HttpProvider("https://ropsten.infura.io/"));

var result=web3.eth.accounts.create('passswordseed')
console.log(result.address);
console.log(result.privateKey);
 

 

시드주소로 쫙쫚 뽑아 내면 됨

 

블로그 이미지

iesay

,

 

https://ropsten.etherscan.io/api?module=account&action=txlist

&address=0xFf0797D06e8F9897B1D5066C10D9497Ed7054A47

&startblock=0&endblock=99999999&page=1&offset=30&sort=desc

&apikey=@@@@@@@@@

한줄로 입력해야됨

 

 

 

API는 가입하면 KEY주고  메인넷이더리움  , ropsten 동시 사용 가능

https://etherscan.io/apis#accounts

 

 

 

sort=desc 옵션까지 주어서 최신자료가 가장 위에 보이게

지갑 만드시는분 안드로이드클라나,,,,,, 웹이면 DB에 박하넣고

새로고침하면 계속 이벤트 발생시켜서 업데이트 되는 내역 찔러 넣으면 됨..

 

'이더리움' 카테고리의 다른 글

이더스캔API erc20token 트렌젝션 조회  (0) 2018.11.30
입금주소 생성  (0) 2018.11.30
geth 설치 이더리움노드  (0) 2018.11.29
이더리움 infura.io 주소  (0) 2018.11.28
이더스캔 제작3 (개인별 송금조회)  (0) 2018.11.28
블로그 이미지

iesay

,


#!/bin/bash

sudo apt-get install git -y

git clone https://github.com/ethereum/go-ethereum

sudo apt-get install -y build-essential

sudo apt-get install curl -y

curl -O https://dl.google.com/go/go1.9.7.linux-amd64.tar.gz

tar -xzf go1.9.7.linux-amd64.tar.gz

sudo mv go /usr/local

echo 'GOPATH="/usr/local/go"' >> ~/.profile

echo 'PATH="$PATH:$GOPATH/bin"' >> ~/.profile

source .profile

cd ~/go-ethereum/

make geth

cd ~/go-ethereum/build/bin

sudo mv geth /usr/bin/

'이더리움' 카테고리의 다른 글

입금주소 생성  (0) 2018.11.30
이더스캔API 계좌 account 트렌젝션 조회  (0) 2018.11.30
이더리움 infura.io 주소  (0) 2018.11.28
이더스캔 제작3 (개인별 송금조회)  (0) 2018.11.28
이더스캔 제작3 (입금)  (0) 2018.11.26
블로그 이미지

iesay

,

 


Main Ethereum Network
https://mainnet.infura.io/
wss://mainnet.infura.io/ws

 

Test Ethereum Network (Ropsten)
https://ropsten.infura.io/
wss://ropsten.infura.io/ws

 

Test Ethereum Network (Kovan)
https://kovan.infura.io/
wss://kovan.infura.io/ws

 

Test Ethereum Network (Rinkeby)

https://rinkeby.infura.io/
wss://rinkeby.infura.io/ws

 

infura에 가입하면 API주소도 준다. 지금까지 테스트해보면 별반 차이 없어 보인다.

 

'이더리움' 카테고리의 다른 글

이더스캔API 계좌 account 트렌젝션 조회  (0) 2018.11.30
geth 설치 이더리움노드  (0) 2018.11.29
이더스캔 제작3 (개인별 송금조회)  (0) 2018.11.28
이더스캔 제작3 (입금)  (0) 2018.11.26
이더스캔 제작2  (0) 2018.11.26
블로그 이미지

iesay

,

Error: The current provider doesn't support subscriptions: HttpProvider
    at Subscription.subscribe (/root/node_modules/web3-core-subscriptions/src/subscription.js:206:20)
    at Eth.subscribe (/root/node_modules/web3-core-subscriptions/src/index.js:67:39)

위와 같은 수많은 에러를 토해 내더니

wss 에서는 subscribe이 먹힌다.

 

const Web3 = require("web3");
const WSS = "wss://ropsten.infura.io/ws";
var provider = new Web3.providers.WebsocketProvider(WSS);
var web3 = new Web3(provider);
var name = 'newBlockHeaders'; // e.g.

web3.eth.subscribe(name, (error, result) => {
        if(!error) {
            console.log(result);
        } else {
            console.log('Error:', error);
        }
    }).on("data", function (transaction) {
        console.log(transaction);
});

 

 

 

 

 

('0x565000ed16f67048320398e83cb66c28c3d4db77bb50fdb1826cf36e3af04de1').then(console.log);
const web3 = new Web3(new Web3.providers.HttpProvider("https://ropsten.infura.io/"));

var receipt = web3.eth.getTransactionReceipt('0x565000ed16f67048320398e83cb66c28c3d4db77bb50fdb1826cf36e3af04de1').then(console.log); 

두 함수의 차이는 차차 알아 보도록 하자

트랜젝션을 필터해서 DB에 넣어서 사용자에게 보여줄듯,,

 

 

 

 

 

 

'이더리움' 카테고리의 다른 글

geth 설치 이더리움노드  (0) 2018.11.29
이더리움 infura.io 주소  (0) 2018.11.28
이더스캔 제작3 (입금)  (0) 2018.11.26
이더스캔 제작2  (0) 2018.11.26
이더스캔 제작1  (0) 2018.11.23
블로그 이미지

iesay

,

입금

 

리눅스 버전 : ubuntu-18.04.1-desktop-amd64.iso 

 

입출금은 web3.js에서 개인키가지고 공개키 뽑고 이것저것 하면 되는거 같은데

개인별 송금조회는 @_@;;???

 

저번에도 한번 실패 했던거다.

 

블록체인 프로그래밍에서 가장 큰 문제점은 이론을 공부해야 된다.

이론이 뒷받침 되지 않고서는 절대 코딩 진도가 안나간다.

 

공개키도 개인키에서 뽑아내어서 사용하고

노드에서 검증도 개인키로 트랜잭션서명하고 공개키도 같이 보내는 형태다.

 

이런 이론을 공부하지 못하면 절대 코딩 진도가 안나간다.

 

그래서 일반 프로그래머들이 블록체인을 어려워할수도 있다.

 

npm install web3

apt-get install git

node

설치 완료

 

내일은 꼭 성공시킨다.

Web3 = require("web3");
web3 = new Web3(new Web3.providers.HttpProvider("https://ropsten.infura.io/v3/f76f49a440bf4303ab6d2c1aa21c7537"));
const toAddress = "0x7a0e3AB3c9626018850c06A099981F0B1f183D95";
const privateKey = "A209084D071D63F598EB5C3A1B315CE8BDFED7906FF6D071CDADAB34244AAA69";
web3.eth.accounts.signTransaction({
      to: toAddress,
      value: "100000000",
      gas: 21000
  }, privateKey, function (err, result) {
      if (err) {
          console.error(err);
          return;
      }
      console.log('rawTransaction ${result.rawTransaction}');
      web3.eth.sendSignedTransaction(result.rawTransaction).on('receipt', console.log);
  });  

 

 

 

var Web3 = require("web3")
var web3 = new Web3("https://ropsten.infura.io/v3/f76f49a440bf4303ab6d2c1aa21c7537")
var privateKey = "0xA209084D071D63F598EB5C3A1B315CE8BDFED7906FF6D071CDADAB34244AAA69"

var tx = {
    from: '0xFf0797D06e8F9897B1D5066C10D9497Ed7054A47',
    to: '0x7a0e3AB3c9626018850c06A099981F0B1f183D95',
    value: '1000000000',
    gas: 2000000,
    gasPrice: '234567897654321',
    nonce: 0,
    chainId: 3
}

var signed = web3.eth.accounts.signTransaction(tx, privateKey).then(console.log)
web3.eth.sendSignedTransaction(signed.rawTransaction)

{ messageHash: '0xf5845092cc8c2a842e58ec09c1d67faff14e9cfd8fde43291c9dba8174460507',
  v: '0x2a',
  r: '0x26a57ca1e79008a42e14605c8924618b9b3e4971f0c94d6bd8bb67ce49f1da1f',
  s: '0x1dc9cf69f088941767858934ffdec7e16c458ae4175c6343977647767d220f38',
  rawTransaction: '0xf86a8086d55698372431831e8480947a0e3ab3c9626018850c06a099981f0b1f183d95843b9aca00802aa026a57ca1e79008a42e14605c8924618b9b3e4971f0c94d6bd8bb67ce49f1da1fa01dc9cf69f088941767858934ffdec7e16c458ae4175c6343977647767d220f38' }

 

web3.eth.signTransaction  -> web3.eth.accounts.signTransaction

두함수는 서로 다름

 

 

 

Web3 = require("web3");

 

 

 

 

 Web3 = require("web3"); web3 = new Web3(new Web3.providers.HttpProvider("https://ropsten.infura.io/v3/f76f49a440bf4303ab6d2c1aa21c7537"));

 

 

 

 

 

 

송금완료

const Web3 = require("web3");
const web3 = new Web3(new Web3.providers.HttpProvider("https://ropsten.infura.io/v3/f76f49a440bf4303ab6d2c1aa21c7537"));
const toAddress = "0x7a0e3AB3c9626018850c06A099981F0B1f183D95";
const privateKey = "0xA209084D071D63F598EB5C3A1B315CE8BDFED7906FF6D071CDADAB34244AAA69";
web3.eth.accounts.signTransaction({
      to: toAddress,
      value: "300000000000000000",
      chainId: 3,
      gas: 21000
  }, privateKey, function (err, result) {
      if (err) {
          console.error(err);
          return;
      }
      console.log('rawTransaction ${result.rawTransaction}');
      web3.eth.sendSignedTransaction(result.rawTransaction).on('receipt', console.log);
  });
 

 

'이더리움' 카테고리의 다른 글

geth 설치 이더리움노드  (0) 2018.11.29
이더리움 infura.io 주소  (0) 2018.11.28
이더스캔 제작3 (개인별 송금조회)  (0) 2018.11.28
이더스캔 제작2  (0) 2018.11.26
이더스캔 제작1  (0) 2018.11.23
블로그 이미지

iesay

,

이더스캔 제작2

이더리움 2018. 11. 26. 11:13

이더리움 테스트서버 ropsten기준으로 제작하였다.

파싱받아서 그걸 DB에 넣어서 input에서 조회하면 뿌려주면 된다.

말로는 졸라 쉽지

만들러면 ,,,,

 

web3.js도 git에서 가지고 오기 때문에 바로 소스 복붙해서 붙어 넣기 하면 사용 가능

위에 input은 어카운트 조회고

아래 textarea는 트렌젝션 조회내용을 담는거다.

 

 


<head>
<script type="text/javascript" src="https://github.com/ethereum/web3.js/blob/develop/dist/web3.js"></script>
<script type="text/javascript" src="https://github.com/MikeMcl/bignumber.js/blob/master/bignumber.min.js"></script>
<script type="text/javascript">
var result ="";
var web3 = new Web3();
var provider = new web3.providers.HttpProvider('https://ropsten.infura.io/');
web3.setProvider(provider);
function check_select() {
        var address = "0xFf0797D06e8F9897B1D5066C10D9497Ed7054A47";
        var tx="0xf7754179b1f735361ef63be6f940b9aaa163149ca05f9bb0f3791290701ec46f";
        var balance = web3.fromWei(web3.eth.getBalance(address), 'ether');
        document.getElementById("abc").value=balance;
        var receipt = web3.eth.getTransactionReceipt(tx);
        result = "tx:  "+tx+"\n\n";
        result+="blockHash:  "+receipt.blockHash+"\n\n";
        result+="blockNumver:  "+receipt.blockNumber+"\n\n";
        result+="cumulativeGasUsed: "+receipt.cumulativeGasUsed+"\n\n";
        result+="from: "+receipt.from+"\n\n";
        result+="gasUsed: "+receipt.gasUsed+"\n\n";
        result+="status:  "+receipt.status+"\n\n";
        result+="to:  "+receipt.to+"\n\n";
        result+="transactionHash:  "+receipt.transactionHash+"\n\n";
        result+="transactionIndex: "+receipt.transactionIndex+"\n\n";
        document.getElementById("output").value=result;
        console.log(receipt);
        }
</script>
</head>
<body>
Ropsten test ethereum Server
<br/>
<input type="button" name="" value="select" onclick="check_select();"/>
<br/>
balance account: <input type='text' id="abc" readonly/>
<br/>
<br/>
transaction check
<br/>
<textarea id="output" style="width:70%; height:70%" readonly/>
</body>
</html>
 

 

 

'이더리움' 카테고리의 다른 글

geth 설치 이더리움노드  (0) 2018.11.29
이더리움 infura.io 주소  (0) 2018.11.28
이더스캔 제작3 (개인별 송금조회)  (0) 2018.11.28
이더스캔 제작3 (입금)  (0) 2018.11.26
이더스캔 제작1  (0) 2018.11.23
블로그 이미지

iesay

,

이더스캔 제작1

이더리움 2018. 11. 23. 10:09

나만의 이더스캔을 만들어볼 생각이다.

 <html>
<head>
<script type="text/javascript" src="https://github.com/ethereum/web3.js/blob/develop/dist/web3.js"></script>
<script type="text/javascript" src="https://github.com/MikeMcl/bignumber.js/blob/master/bignumber.min.js"></script>
<script type="text/javascript">
  var web3 = new Web3();
  var provider = new web3.providers.HttpProvider('https://ropsten.infura.io/');
    web3.setProvider(provider);
function updateBalance() {
     var address = "0xFf0797D06e8F9897B1D5066C10D9497Ed7054A47";
     var balance = web3.fromWei(web3.eth.getBalance(address), 'ether');
     document.getElementById("abc").value=balance;
        var receipt = web3.eth.getTransactionReceipt('0xf7754179b1f735361ef63be6f940b9aaa163149ca05f9bb0f3791290701ec46f');
document.getElementById("123").value=receipt;
console.log(receipt);
}
 function stopWatch() {
      stop = true;
    }
</script>
<body>
<input type="button" name="" value="start" onclick="updateBalance();"/>
<input type="button" name="" value="stop" onclick="stopWatch();"/>
<input type='text' id="abc" readonly/>
<br/>
<input type='text' id="123" readonly/>
</body>
</html>

 

 

 

인풋화면을 클릭하면 'https://ropsten.infura.io/테스트 서버에

계좌 잔액을 조회하는 0xFf0797D06e8F9897B1D5066C10D9497Ed7054A47

형태다.

 

 

 

Ropsten 테스트서버의 동일한 계좌다. 소수점 차이는 조금 난다.

 

머털도사가 머리털만 세우면 다 응용해서 배운거라고 누더기 도사가 이야기했다

자바스크립트로 조회했으니 나머지 부분은 다 응용해서 만들면 된다.

 

실력 되는 분들은 혼자 만들어 보길 바란다.

 

 

 

'이더리움' 카테고리의 다른 글

geth 설치 이더리움노드  (0) 2018.11.29
이더리움 infura.io 주소  (0) 2018.11.28
이더스캔 제작3 (개인별 송금조회)  (0) 2018.11.28
이더스캔 제작3 (입금)  (0) 2018.11.26
이더스캔 제작2  (0) 2018.11.26
블로그 이미지

iesay

,