김보안의 블로깅
  • 🏠 Home
  • 📚 Project
    • Blockchain
      • 🎦 PickMe
      • 🎦 IoTC
      • 🎦 Blackchain
      • 📃 Gemology
      • 🎦 PickMe
      • 🎦 PickMe
    • AI
      • 👋 A.I. Dream Reader
      • 🎦 A.I. Dream Reader
    • Security
      • 🎦 SNAC
    • Education
      • 🎦 Smart Lecture
  • 🤸‍♂ Hobby
    • Music
      • Violin
      • Guitar
      • Piano
      • Drum
    • Flower
      • Flower Certificate
    • Sport
      • Ski
      • Skateboard
      • Golf
      • Boxing

2019년 2월 24일 일요일

Plasma Leap (leap-node, leap-core, leap-contracts 등) 구동 자동화

 SecureKim     오전 3:50     Automation, Blockchain, Plasma, Plasma leap     No comments   


전체를 재구동 하는 일이 잦아 자동화 하였고, Eth 넣어주는 동작까지 잘 되는것을 확인하였습니다.

Base를 위한 자동화는
https://github.com/securekim/auto-leap
에 최신 버전이 있으니 참고하세요

먼저 auto-leap.js 의 METAMASK_ACCOUNT 는 본인의 METAMASK 계정으로 수정해야 합니다.

수정 이후 yarn add web3 한번 하고 auto-leap.sh 을 leap-node, leap-contracts 등이 있는 폴더 위에서 돌리면

truffle 실행, contract compile, contract deploy, node / bridge / remix, auto-leap.js 를 실행 해 줍니다.

이후 auto-leap.js 에서는 METAMASK 계정에 10 이더를 넣어주고

컨트랙트 주소, 계정 주소를 leap-node.log 에 출력해 줍니다.

※ 8545 로 동작하도록 해 두어 remix 에서 포트 수정할 필요가 없습니다.

cat auto-leap.js

const METAMASK_ACCOUNT = "0x9C73363B89C0Eda0dbA1B4a5250E891F60723378"; //바꾸세요

var Web3 = require("web3");
const fs = require('fs');

//const web3 = new Web3(Web3.givenProvider || 'ws://localhost:9545');//, options); //FOR CONSOLE
const web3 = new Web3(Web3.givenProvider || 'http://localhost:8545');//, options); //FOR TEST RPC


web3.eth.getAccounts((error, result) => {
web3.eth.sendTransaction(
{from:result[0],
to:METAMASK_ACCOUNT, //CHANGE IT (METAMASK)
value: "10000000000000000000",
data: "0xdf"
}, (err, transactionHash) => {
if (!err)
console.log(transactionHash + " success");
});

fs.appendFile('auto-leap.log', '\nTruffle Account :\n ' + result[0] + '\n', function (err) {
if (err) throw err;
console.log('Saved!');
});

fs.appendFile('auto-leap.log', '\nMetamask Account :\n ' + METAMASK_ACCOUNT + '\n', function (err) {
if (err) throw err;
console.log('Saved!');
});
});


cat auto-leap.sh

#!/bin/bash
sudo killall -9 node
sudo killall -9 sudo
cd leap-contracts
truffle networks --clean
clear
testrpc&
sleep 3
truffle compile
truffle migrate --reset
truffle networks > ../auto-leap.log
sed -i 's/undefined\:undefined/localhost\:8545/g' build/nodeFiles/generatedConfig.json
cd ../leap-node
node index.js --config=../leap-contracts/build/nodeFiles/generatedConfig.json&
cd ../leap-contracts
sudo remixd -s . --remix-ide "https://remix.ethereum.org"&
python -mwebbrowser https://remix.ethereum.org&
cd ../bridge-ui
yarn start&
sleep 5
python -mwebbrowser http://localhost:1234&
cd ..
node auto-leap.js
실행 위치를 위한 구조는 아래와 같습니다.

├── auto-leap.js     // Metamask 계정에 10 이더 넣어 줌
├── auto-leap.log  // 컨트랙트 주소, 계정 주소 알려줌
├── auto-leap.sh   // truffle 실행, contract compile, contract deploy, node / bridge / remix
├── bridge-ui
├── leap-contracts
├── leap-core
├── leap-node
├── node_modules


testrpc 설치가 필요합니다.

sudo npm install -g –production windows-build-tools 
sudo npm install -g ethereumjs-testrpc 


Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

2019년 2월 9일 토요일

Javascript 배열 복사 (Deep copy, Shallow copy)

 SecureKim     오전 2:01     깊은 복사, 복사, 얕은 복사, Array, Deep copy, Javascript, Node.js, Shallow copy     2 comments   


자바스크립트 변수 중 배열을 복사하는 것은 두가지 유형이 있습니다.

copyArr = originArr 로는 일반적으로 의도하는 Deep copy가 이루어 지지 않기 때문에, 아래를 참조하시기 바랍니다.

1. 참조

origin = [1,2,3];
var copy = origin;

copy 된 변수가 origin 을 가리키고 있는 상태입니다.
즉, copy 값이 변경되면 origin 도 함께 변경됩니다.

copy[1] = 5; // origin [1, 5, 3];

2. Shallow copy 

copy 된 변수의 값이 변경되어도 origin 은 변하지 않습니다.


Example


Speed

Deep copy 에서 가장 빠른것은 slice(0) 이므로 이것을 이용하면 되겠습니다.









Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
최근 게시물 이전 게시물 홈

페이지

  • 홈
  • Hobby

Categories

  • AI
  • AWS
  • Blockchain
  • Hardware
  • Javascript
  • Node.js
  • Plasma
  • Security
  • Study
  • Video
  • android
  • mysql
  • review
  • windows

Popular Posts

  • 다빈치리졸브로 영상의 음성 보정 (잡음 노이즈 없애기)
      잡음 없애는 방법 1. 음악 쪽 들어가서 음악에서 소스 우클릭 - Normalize Audio Levels 2. 우측의 Mixer에서 Dynamics 더블클릭, Effects아래 +누르고 Metering에 Meter 그럼 아래처럼 나오는데  Gat...
  • 회사 프록시와 인증서에 고통받는 그대를 위한 글 (Bash, Gradle, Python, wget, nodejs(npm), apt-get, cURL, git, yarn, androidStudio)
    대기업에 입사하면 장단점이 있는데, 단점 중에 하나가 회사에서 프록시를 사용하여 트래픽 감시를 하므로 프록시 설정을 해주어야 한다는 점 입니다. 특히, 회사에서는 https 트래픽도 감시를 하므로 인증서도 설정해 주어야 합니다. 그런데 문...
  • 블루투스 BLE 보안 모드와 보안 레벨 (BLE SECURITY MODE and SECURITY LEVEL)
      BLE에서 무슨 모드와 무슨 레벨을 사용해야 가장 안전할까? (글 맨 밑에 답 있음) 블루투스는 워낙 표준이 다양하고 버전따라서 달라서 다들 다른 이야기를 하는 것 같다. BLE와 BT는 전혀 별개의 표준인데 같은거라고 이야기하는 사람도 있고 특히...

Blog Archive

  • ►  2025 (1)
    • ►  7월 (1)
  • ►  2024 (2)
    • ►  11월 (2)
  • ►  2023 (2)
    • ►  10월 (1)
    • ►  1월 (1)
  • ►  2022 (10)
    • ►  12월 (1)
    • ►  11월 (3)
    • ►  9월 (1)
    • ►  8월 (1)
    • ►  6월 (2)
    • ►  3월 (2)
  • ►  2021 (9)
    • ►  12월 (3)
    • ►  11월 (1)
    • ►  6월 (1)
    • ►  5월 (2)
    • ►  4월 (2)
  • ►  2020 (12)
    • ►  10월 (1)
    • ►  9월 (2)
    • ►  7월 (1)
    • ►  6월 (1)
    • ►  5월 (5)
    • ►  4월 (1)
    • ►  2월 (1)
  • ▼  2019 (14)
    • ►  10월 (2)
    • ►  7월 (1)
    • ►  3월 (4)
    • ▼  2월 (2)
      • Plasma Leap (leap-node, leap-core, leap-contracts ...
      • Javascript 배열 복사 (Deep copy, Shallow copy)
    • ►  1월 (5)
  • ►  2018 (14)
    • ►  12월 (2)
    • ►  11월 (4)
    • ►  10월 (1)
    • ►  8월 (2)
    • ►  5월 (4)
    • ►  1월 (1)
  • ►  2017 (12)
    • ►  10월 (2)
    • ►  9월 (9)
    • ►  5월 (1)
  • ►  2016 (8)
    • ►  10월 (2)
    • ►  8월 (1)
    • ►  6월 (1)
    • ►  1월 (4)
  • ►  2015 (6)
    • ►  12월 (3)
    • ►  10월 (1)
    • ►  6월 (1)
    • ►  5월 (1)
  • ►  2014 (10)
    • ►  11월 (1)
    • ►  9월 (1)
    • ►  7월 (1)
    • ►  6월 (1)
    • ►  5월 (3)
    • ►  4월 (1)
    • ►  3월 (2)
  • ►  2013 (28)
    • ►  12월 (3)
    • ►  11월 (6)
    • ►  10월 (6)
    • ►  9월 (6)
    • ►  8월 (1)
    • ►  7월 (3)
    • ►  6월 (3)

구독

글
Atom
글
전체 댓글
Atom
전체 댓글

로드 중입니다...

각오

직접 해보지 않은 것은 포스팅 하지 않겠습니다.

Copyright © 김보안의 블로깅 | Powered by Blogger
Design by Hardeep Asrani | Blogger Theme by NewBloggerThemes.com | Distributed By Gooyaabi Templates