Blockchain By Example
上QQ阅读APP看书,第一时间看更新

Interacting  with the contract

After we've deployed the contract, we can interact with the contract instance in the Testnet network, using the same Remix tool we used in the deployment. If the deployment succeeded, Remix will provide you with a form in the right-hand pane to execute the contract's methods. In our case, we'll pass a new message as a string (with quotes) hello to the method set():

Then press the blue Message button to make Remix request the variable value from the contract's storage. It will return the last stored value, hello, as expected.

Great! You've successfully built and deployed your first contract in the RSK Testnet network. If you are tempted to deploy your contract in the main network, you have to whitelist your account by making a request to the RSK team, as the network is closed to whitelisted participants.

RSK isn't the only attempt to bring advanced smart contract capabilities to bitcoin. Other projects, such as Counterparty, aim to provide a protocol based on bitcoin to enable Ethereum-like smart contracts and building DApps. On the other hand, unlike the former, which is based on Ethereum, Ivy is a new smart contract language that compiles to bitcoin scripts. To play around with Ivy, you can use an online contracting tool: https://ivy-lang.org/bitcoin.