const ProgressBar = require('progress');
const progressBar = new ProgressBar('Checking [:bar] :current/:total :percent :etas', { total: totalMembers });
progressBar.tick();
[카테고리:] Development
[git] send-pack: unexpected disconnect while reading sideband packet 에러 발생 시
git push 를 했을 때, 내용이 많은 경우 다음과 같은 에러가 날 때가 있다.
error: RPC failed; HTTP 400 curl 22 The requested URL returned error: 400
send-pack: unexpected disconnect while reading sideband packet
이 경우, http.postBuffer를 다음과 같이 늘려준다. 아래는 150MB.
git config --global http.postBuffer 157286400
[ethers.js] HD wallet으로 주소 파생
12개의 seed wallet이 있는 경우, 다음과 같이 파생 주소를 확인할 수 있다.
$ npm install ethers@^5.0.0
const { ethers } = require('ethers');
// 12개의 시드 단어를 여기에 입력하세요
const mnemonic = "Your seed 12 words here";
// HD Node 생성
const hdNode = ethers.utils.HDNode.fromMnemonic(mnemonic);
// 파생 경로 설정
const derivationPath = "m/44'/60'/0'/0/"; // "m/44'/905956'/0'/0/" 와 같이 사용도 가능
// 파생 주소 생성 및 출력 함수
function generateAddresses(count) {
const addresses = [];
for (let i = 0; i < count; i++) {
const walletNode = hdNode.derivePath(derivationPath + i);
console.log(i, walletNode.address);
addresses.push({
index: i,
address: walletNode.address,
});
}
return addresses;
}
// 원하는 주소 개수를 설정하세요
const numAddresses = 85535;
const addresses = generateAddresses(numAddresses);
openssl로 랜덤하게 키 생성
아래와 같이 랜덤하게 키를 생성한다.
openssl rand -base64 64
[hardhat] network forking
hardhat: {
chainId: 31337,
forking: {
url: 'http://jsonrpc.dasomoli.org:8545',
blockNumber: 74924548,
enabled: true,
},
gasPrice: 800000000000,
hardfork: 'grayGlacier',
chains: {
31337: {
hardforkHistory: {
petersburg: 0,
grayGlacier: 25980000,
},
},
},
},
[ethers.js] 특정 주소의 nonce 얻기
await provider.getTransactionCount(address, 'pending');
'latest' 넣으면 최근 성공 트랜잭션 이후의 nonce 값을 얻음
[SpringBoot] Springboot CLI 설치
brew tap spring-io/tap
brew install spring-boot
springboot 로 bcrypt 패스워드 인코딩을 하려면, 다음과 같이 하면 된다.
spring encodepassword super1234!!
https://docs.spring.io/spring-boot/docs/current/reference/html/cli.html 를 참고.
[Linux] systemd의 로그 출력, journalctl
$ journalctl -u <unit> -f
unit은 systemctl list-units 했을 때 나오는 unit이다. 예를 들면,
$ journalctl -u besu.service -f
[hardhat] hardhat node 외부 접근 가능하게
hardhat node를 외부에서 접근 가능하게 하고 싶은 경우 node 명령을 줄 때 --hostname 0.0.0.0 을 주면 된다.
npx hardhat node --network hardhat --hostname 0.0.0.0
Semantic Versioning 시의 ^, ~, = 의 의미
npm 혹은 Solidity 등은 Semantic Versioning을 사용해서 버전을 정합니다. Semantic Version은 MAJOR.MINOR.PATCH 형식의 버전 명을 말합니다. https://semver.org/ 를 참고해 봅시다.
MAJOR의 경우, 이전과 호환되지 않는 변경이 있는 경우 올립니다.
MINOR의 경우, 이전과 호환되지만 기능 추가 등 주요 변경이 있는 경우 올립니다.
PATCH의 경우, 이전과 호환되고, 버그 수정, 내부 리팩토링 등의 변경이 있는 경우 올립니다.
현재 프로젝트에서 사용하는 버전을 지정할 때 ^, ~, – 등의 기호로 지정하는데 다음과 같은 뜻을 갖습니다.
^ (캐럿): 마이너 버전이나 패치 버전으로 호환되는 업데이트를 할 수 있습니다. 예를 들어, “^1.2.3″을 지정한 경우, 1로 시작하고 2.3보다 크거나 같은 마이너 또는 패치 버전을 말합니다. 따라서 1.2.3, 1.2.4, 1.3.0 등은 해당되지만 2.0.0은 해당되지 않습니다.
~ (틸더): 패치 버전만 호환되는 업데이트를 할 수 있습니다. 예를 들어, “~1.2.3″을 지정한 경우, 1.2로 시작하는 패치 버전이 3보다 크거나 같은 모든 버전을 말합니다. 따라서 1.2.3, 1.2.4는 해당되지만 1.3.0은 해당되지 않습니다.
= (이퀄): 지정한 정확한 버전만 말합니다. 예를 들어 “1.2.3”을 지정한 경우, 정확히 1.2.3만 해당됩니다.