2017-11-08 19 views
0

web3jGeth으로 Ethereum 스마트 계약을 테스트하고 있습니다. Geth 그런 스크립트 실행 :개인 블록 체인에서 게스 거래를 빠르게하는 방법은 무엇입니까?

PASSFILE=/var/folders/_l/kl9pdj2x50v7416j8htb6w740000gn/T/pwd6597172766860806720.tmp 
DATADIR=/var/folders/_l/kl9pdj2x50v7416j8htb6w740000gn/T/geth808290308908087582 
IPCPATH=/var/folders/_l/kl9pdj2x50v7416j8htb6w740000gn/T/geth808290308908087582/geth.ipc 

geth --datadir $DATADIR account new --password $PASSFILE 
geth --datadir $DATADIR \ 
    --ipcpath $IPCPATH \ 
    --dev \ 
    --rpc \ 
    --mine \ 
    --networkid 1999 

은 (경로 테스트에서 생성됩니다).

스마트 계약 래퍼가 web3j-maven-plugin으로 생성됩니다.

166955 [main] INFO FeatureTest - Deploying feature ... 
182006 [main] INFO FeatureTest - Checking feature is listed ... 

Web3j는 IPC를 통해 연결된다 :

(당신이 1 개 거래 16 초가 소요 볼 수 있습니다)

private TransactionReceipt deployFeature_() throws Exception { 
    logger.info("Deploying feature ..."); 
    return contract.deployFeature(featureKey).send(); 
} 

로그 :

문제는 모든 send() 호출이 몇 초 정도 걸립니다이다

web3 = Web3j.build(new UnixIpcService(ipcPath)); 

어떻게 호출 속도를 높일 수 있습니까? TestRPC으로 테스트 할 때마다 1 초도 걸리지 않습니다! Geth--dev으로 시작되기 때문에 기원 파일 자체를 생성하므로 어려움을 바꿀 수 없습니다. 또한 블록이 매우 빠르게 채광되는 것을 볼 수 있습니다.

INFO [11-09|00:34:39] Commit new mining work     number=9 txs=0 uncles=0 elapsed=2.000s 
INFO [11-09|00:34:39] Successfully sealed new block   number=9 hash=b869ca…870644 
INFO [11-09|00:34:39] block reached canonical chain   number=4 hash=c758a0…a529af 
INFO [11-09|00:34:39] mined potential block     number=9 hash=b869ca…870644 
INFO [11-09|00:34:39] Commit new mining work     number=10 txs=0 uncles=0 elapsed=84.12µs 
INFO [11-09|00:34:40] Successfully sealed new block   number=10 hash=5e81a9…fc1364 
INFO [11-09|00:34:40] block reached canonical chain   number=5 hash=465c2b…78461a 
INFO [11-09|00:34:40] mined potential block     number=10 hash=5e81a9…fc1364 

어떤 이유로 든 호출이 빠르지 않습니다. 내가 무엇을 할 수 있을지?

+0

시도. 기본적으로 128MB입니다. – palik

+0

방금'--fast --cache = 1024'를 시도했지만 모든 트랜잭션은 ~ 15 초 동안 지속됩니다. – 4ntoine

답변