0

I am working on the substrate contract node to instantiate a contract using RPC call. I use the this tutorial to do the process. I am getting the message that it is in the block, but not finalized.

const code_contract = new CodePromise(api, metadata, wasm_1);
    // console.log(contract)
    const keyring = new Keyring({ type: 'sr25519' });
    
    const alicePair = keyring.addFromUri('//Alice', { name: 'Alice default' });
    console.log(alicePair.address);
    const gasLimit = 100000n * 1000000n;
    const storageDepositLimit = null;
    const salt = new Uint8Array();
    const value = 0;
    const initValue = true;

    const tx = code_contract.tx.new({ gasLimit, storageDepositLimit }, initValue);
    
    const unsub = await tx.signAndSend(alicePair, ({ events =[],contract, status }) => {
      if (status.isInBlock || status.isFinalized) {
        console.log(status.isInBlock)
        console.log("type is  ",status.type)
        console.log(status.isFinalized)
        console.log('Included at block hash', status.asInBlock.toHex())
        unsub();
      }
    });

I get the following

is api connected   :  true
5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY
true
type is   InBlock
is finalized false
Included at block hash 0x2254bf48bbea0018d939e222e64e42ccb1babf836fbe6f76ac16e8fa230e01fc

I don’t know why isFinalized returns false.

The above happens when I use substrate-contract-node for running the service.

For contract I use the basic flipper contract of ink!

1 Answer 1

1

The consensus algorithm is manual-seal which doesn't contain GRANDPA. Manual seal makes development more convenient since blocks are only authored immediately at every transaction. However, since GRANDPA is not used in the runtime, blocks are never finalized.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.