Sei network 合约开发
1、环境设置
export ENDPOINT=tcp://54.67.88.181:26657
export CHAIN_ID=sei-devnet-1
[root@devnew sei]# export ACCOUNT_NAME="nextdao"
[root@devnew sei]# seid keys add $ACCOUNT_NAME
Enter keyring passphrase:
- name: nextdao
type: local
address: sei17pfj6kzt2wx9lupap8z3sdm6gcx9af6hmcf72j
pubkey: xxxx'
mnemonic: ""
**Important** write this mnemonic phrase in a safe place.
It is the only way to recover your account if you ever forget your password.
export ACCOUNT_ADDRESS="sei17pfj6kzt2wx9lupap8z3sdm6gcx9af6hmcf72j"
seid q bank balances $ACCOUNT_ADDRESS --node $ENDPOINT --chain-id $CHAIN_ID
upload contract
RES1=$(seid tx wasm store /root/go/bin/cw-contracts/contracts/cw-to-do-list/artifacts/cw_to_do_list.wasm -y --from=$ACCOUNT_NAME --chain-id=$CHAIN_ID --node $ENDPOINT --gas=700000 --fees=100000usei --broadcast-mode=block)
code: 4 codespace: sdk data: "" events: - attributes: - index: false key: c3BlbmRlcg== value: c2VpMTdwZmo2a3p0Mnd4OWx1cGFwOHozc2RtNmdjeDlhZjZobWNmNzJq - index: false key: YW1vdW50 value: MTAwMDAwdXNlaQ== type: coin_spent - attributes: - index: false key: cmVjZWl2ZXI= value: c2VpMTd4cGZ2YWttMmFtZzk2MnlsczZmODR6M2tlbGw4YzVsYTRqa2R1 - index: false key: YW1vdW50 value: MTAwMDAwdXNlaQ== type: coin_received - attributes: - index: false key: cmVjaXBpZW50 value: c2VpMTd4cGZ2YWttMmFtZzk2MnlsczZmODR6M2tlbGw4YzVsYTRqa2R1 - index: false key: c2VuZGVy value: c2VpMTdwZmo2a3p0Mnd4OWx1cGFwOHozc2RtNmdjeDlhZjZobWNmNzJq - index: false key: YW1vdW50 value: MTAwMDAwdXNlaQ== type: transfer - attributes: - index: false key: c2VuZGVy value: c2VpMTdwZmo2a3p0Mnd4OWx1cGFwOHozc2RtNmdjeDlhZjZobWNmNzJq type: message - attributes: - index: false key: ZmVl value: MTAwMDAwdXNlaQ== type: tx - attributes: - index: false key: YWNjX3NlcQ== value: c2VpMTdwZmo2a3p0Mnd4OWx1cGFwOHozc2RtNmdjeDlhZjZobWNmNzJqLzE= type: tx - attributes: - index: false key: c2lnbmF0dXJl value: dmlHdjZCVzdNOTFYZzU5VDAyNmhDS0ZwV2M1eXBNMU1Ca3NkNmN6U0RMNExCTEZPRXIweFl1YjRWQVhaV2NlcjJ3bGNhejJKUHhRREhHbFQ1emhSbkE9PQ== type: tx gas_used: "656983" gas_wanted: "700000" height: "10459822" info: "" logs: [] raw_log: 'failed to execute message; message index: 0: can not create code: unauthorized' timestamp: "" tx: null txhash: 668EEC13784EA87B8D9F0E8ED2FAE6455398E723F8EF7849D2BBD41EAD5A7A66
export CONTRACT_ID=4 export LABEL=ldh RES2=$(seid tx wasm instantiate $CONTRACT_ID '{}' --chain-id=$CHAIN_ID --from=$ACCOUNT_NAME --gas=200000 --fees=100000usei --broadcast-mode=block --label $LABEL --no-admin)
result
[root@devnew bin]# RES2=$(seid tx wasm instantiate $CONTRACT_ID '{}' --chain-id=$CHAIN_ID --from=$ACCOUNT_NAME --gas=200000 --fees=100000usei --broadcast-mode=block --label $LABEL --no-admin) Enter keyring passphrase: {"body":{"messages":[{"@type":"/cosmwasm.wasm.v1.MsgInstantiateContract","sender":"sei17pfj6kzt2wx9lupap8z3sdm6gcx9af6hmcf72j","admin":"","code_id":"4","label":"ldh","msg":{},"funds":[]}],"memo":"","timeout_height":"0","extension_options":[],"non_critical_extension_options":[]},"auth_info":{"signer_infos":[],"fee":{"amount":[{"denom":"usei","amount":"100000"}],"gas_limit":"200000","payer":"","granter":""}},"signatures":[]} confirm transaction before signing and broadcasting [y/N]: y
[root@devnew bin]# echo $RES2
code: 4 codespace: sdk data: "" events: - attributes: - index: false key: c3BlbmRlcg== value: c2VpMTdwZmo2a3p0Mnd4OWx1cGFwOHozc2RtNmdjeDlhZjZobWNmNzJq - index: false key: YW1vdW50 value: MTAwMDAwdXNlaQ== type: coin_spent - attributes: - index: false key: cmVjZWl2ZXI= value: c2VpMTd4cGZ2YWttMmFtZzk2MnlsczZmODR6M2tlbGw4YzVsYTRqa2R1 - index: false key: YW1vdW50 value: MTAwMDAwdXNlaQ== type: coin_received - attributes: - index: false key: cmVjaXBpZW50 value: c2VpMTd4cGZ2YWttMmFtZzk2MnlsczZmODR6M2tlbGw4YzVsYTRqa2R1 - index: false key: c2VuZGVy value: c2VpMTdwZmo2a3p0Mnd4OWx1cGFwOHozc2RtNmdjeDlhZjZobWNmNzJq - index: false key: YW1vdW50 value: MTAwMDAwdXNlaQ== type: transfer - attributes: - index: false key: c2VuZGVy value: c2VpMTdwZmo2a3p0Mnd4OWx1cGFwOHozc2RtNmdjeDlhZjZobWNmNzJq type: message - attributes: - index: false key: ZmVl value: MTAwMDAwdXNlaQ== type: tx - attributes: - index: false key: YWNjX3NlcQ== value: c2VpMTdwZmo2a3p0Mnd4OWx1cGFwOHozc2RtNmdjeDlhZjZobWNmNzJqLzI= type: tx - attributes: - index: false key: c2lnbmF0dXJl value: SWtnd1lvNEtPcFVIWWlTQXl0K2NMRTZaNHBZL0syNjhodmhieGdQS0UrZ2wrWkJFbHBUa2NkTW9qaVhsREdYSVJnbjhxK2YvcWc2RGQxMTIvQnRIc2c9PQ== type: tx gas_used: "73475" gas_wanted: "200000" height: "10461342" info: "" logs: [] raw_log: 'failed to execute message; message index: 0: can not instantiate: unauthorized' timestamp: "" tx: null txhash: 1C5A1BD9740F0C4F13D2D484EC0BBFC1B209681BECD24F9A509E8A06D14AB2FE