Nervosj部署合约时,参数格式问题

在部署合约时,有个init参数
Transaction tx = Transaction.createContractTransaction(nonce, quota, validUntilBlock, 0, chainId, contractCode, init);
问题:init是是指初始化构造方法的_参数_吗?

部署合约你可以使用createFunctionCallTransaction函数呀。
像这样:
// nonce
BigInteger nonce = BigInteger.valueOf(Math.abs(new Random(System.currentTimeMillis()).nextLong()));
// 构建合约交易
Transaction rtx = Transaction.createFunctionCallTransaction("", nonce, 99999999, gthBlockNumber().longValue() + 100,
0, chainId, TypeEncoder.encode(new Uint256(BigInteger.ZERO)), code);
// 签名
String signedTx = rtx.sign(privateKey, false, false);
AppSendTransaction sendTransaction = service.appSendRawTransaction(signedTx).send();

合约的参数是拼在合约code后面的。

不是,你写contractCode的那个参数,是要转账的原生token的数量,其实部署合约是不需要传value字段的,默认写“0”就好了。init是合约的binary code。如果合约有构造方法的话,将构造方法的bin去掉0x然后加在合约的binanry code的后面就好了。