13 /Nov/ 2018 — ERC721 CryptoKitties

Requirement : Transfer ERC721 token out

Issue 1: Cannot get Token_ID from CryptoKitties smart contract . I have tried tokenOfOwnerByIndex and tokensOfOwner method but still cannot get Token_ID. However, I can find token_ID in the Etherscan.io. How they did?


Issue 2: Try to transfer ERC721 Token by using the transfer function of CryptoKitties smart contract with metamask . It does not work. The solution is to use the sendRawTransaction of Web3.

var setData = App.contracts.Token.transfer.getData(reciever, parseInt(_TokenId), { from: App.account});
web3.eth.getTransactionCount(App.account, function(err, nonce) {
var tx = new ethereumjs.Tx({
nonce: nonce,
gasPrice: 41000000000,
gasLimit: 69379,
to: "0x06012c8cf97bead5deae237070f9587f8e7a266d", // don't change it. It is cryptokitties smart contract address.
value: 0,
data: setData,
chainId: 1
tx.sign(ethereumjs.Buffer.Buffer.from(privateKey, 'hex'));var raw = '0x' + tx.serialize().toString('hex');web3.eth.sendRawTransaction(raw, function(err, transactionHash) {
console.log(transactionHash); });

3. Write “How To trade ERC-721 Tokens by MyEtherWallet

Written by

撰寫任何事情,O型水瓶混魔羯,咖啡愛好者,Full stack/blockchain developer,Founder of Blockchain&Dapps meetup and DeFi-Decentralized-Finance-SG meetup,Udemy teacher。

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store